diff --git a/.flake8 b/.flake8 index 90316de214..f9069a8468 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg new file mode 100644 index 0000000000..b1b695fdfc --- /dev/null +++ b/.kokoro/samples/python3.9/common.cfg @@ -0,0 +1,40 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.9" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-py39" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-aiplatform/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-aiplatform/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/continuous.cfg b/.kokoro/samples/python3.9/continuous.cfg new file mode 100644 index 0000000000..a1c8d9759c --- /dev/null +++ b/.kokoro/samples/python3.9/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic-head.cfg b/.kokoro/samples/python3.9/periodic-head.cfg new file mode 100644 index 0000000000..88d5235e34 --- /dev/null +++ b/.kokoro/samples/python3.9/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-aiplatform/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg new file mode 100644 index 0000000000..71cd1e597e --- /dev/null +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} diff --git a/.kokoro/samples/python3.9/presubmit.cfg b/.kokoro/samples/python3.9/presubmit.cfg new file mode 100644 index 0000000000..a1c8d9759c --- /dev/null +++ b/.kokoro/samples/python3.9/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index dae249ec89..f932577add 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/docs/aiplatform_v1beta1/reasoning_engine_runtime_revision_service.rst b/docs/aiplatform_v1beta1/reasoning_engine_runtime_revision_service.rst new file mode 100644 index 0000000000..9c5b0ae2f9 --- /dev/null +++ b/docs/aiplatform_v1beta1/reasoning_engine_runtime_revision_service.rst @@ -0,0 +1,10 @@ +ReasoningEngineRuntimeRevisionService +------------------------------------------------------- + +.. automodule:: google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service + :members: + :inherited-members: + +.. automodule:: google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.pagers + :members: + :inherited-members: diff --git a/docs/aiplatform_v1beta1/services_.rst b/docs/aiplatform_v1beta1/services_.rst index 0d906736bc..1c07eb87ea 100644 --- a/docs/aiplatform_v1beta1/services_.rst +++ b/docs/aiplatform_v1beta1/services_.rst @@ -34,6 +34,7 @@ Services for Google Cloud Aiplatform v1beta1 API pipeline_service prediction_service reasoning_engine_execution_service + reasoning_engine_runtime_revision_service reasoning_engine_service schedule_service session_service diff --git a/google/cloud/aiplatform/v1/schema/predict/instance/__init__.py b/google/cloud/aiplatform/v1/schema/predict/instance/__init__.py index 3fc6a1f76b..8e42994f07 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/__init__.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/__init__.py index 241b535dd6..1c45bfb6b4 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.image_classification import ImageClassificationPredictionInstance @@ -50,27 +45,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform.v1.schema.predict.instance_v1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/__init__.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/__init__.py index 0aea2a22c7..3c847b4577 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_classification.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_classification.py index 1a1a1e3f2a..a467360fca 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_object_detection.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_object_detection.py index 942bf18280..af025932c7 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_segmentation.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_segmentation.py index 1d9021b823..313abad489 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_classification.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_classification.py index 01d5160303..fbd1afb349 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_extraction.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_extraction.py index ed2ca77094..d8320bc8e3 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_extraction.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_sentiment.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_sentiment.py index 39c6ddac18..312b987a02 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_sentiment.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_action_recognition.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_action_recognition.py index bdca6c28a2..19b5064832 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_classification.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_classification.py index 6d2643abaf..3897038d07 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_object_tracking.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_object_tracking.py index 0c891d3e62..d908e1e55d 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params/__init__.py b/google/cloud/aiplatform/v1/schema/predict/params/__init__.py index 2f9f23dfd8..405008cf66 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/params/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/__init__.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/__init__.py index afd7096894..0395553727 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.image_classification import ImageClassificationPredictionParams @@ -47,27 +42,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform.v1.schema.predict.params_v1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/__init__.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/__init__.py index ecba43ffd1..b0522f2fc3 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_classification.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_classification.py index 5d0ce9a0fb..9993b101c8 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_object_detection.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_object_detection.py index 80bbe1a289..fb37279500 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_segmentation.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_segmentation.py index 1ff783d987..e5af4f162a 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_action_recognition.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_action_recognition.py index 85b978810f..67ab316fe8 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_classification.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_classification.py index ad67a0ffdd..5708c06842 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_object_tracking.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_object_tracking.py index bb869f5a47..b7a5a91649 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction/__init__.py b/google/cloud/aiplatform/v1/schema/predict/prediction/__init__.py index 53b3d469c9..fa698ecf2b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/__init__.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/__init__.py index bcbdee2924..1c52570951 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.classification import ClassificationPredictionResult @@ -51,27 +46,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform.v1.schema.predict.prediction_v1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/__init__.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/__init__.py index 27952c6b7a..cd89016035 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/__init__.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/classification.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/classification.py index 33a9affa7f..8aeab04718 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_object_detection.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_object_detection.py index 30a57c1c07..1d8e05064b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_segmentation.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_segmentation.py index 8a78d9cd6f..4b78941a1d 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_classification.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_classification.py index 58ba84e71b..d97255aa1b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_regression.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_regression.py index 883059a0d3..91d4f5d51c 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_regression.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/tabular_regression.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_extraction.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_extraction.py index b17d648477..1bfff70690 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_extraction.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_sentiment.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_sentiment.py index cc32d8a50e..f4def2f74d 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_sentiment.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_action_recognition.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_action_recognition.py index 6bd702b541..c6c253dd4c 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_classification.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_classification.py index 263b8858d7..701f945917 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_classification.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_object_tracking.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_object_tracking.py index ff14cbd3a8..293d35b051 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition/__init__.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition/__init__.py index cac62d73f0..642d334029 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition/__init__.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/__init__.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/__init__.py index 941066366b..0803d9b562 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/__init__.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.automl_image_classification import AutoMlImageClassification @@ -66,27 +61,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform.v1.schema.trainingjob.definition_v1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/__init__.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/__init__.py index 95b68c6caa..b0813c38c4 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/__init__.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_classification.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_classification.py index e2ff695597..cc2c4d4926 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_classification.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_object_detection.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_object_detection.py index 7feb056ea3..0c885507e6 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_object_detection.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_segmentation.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_segmentation.py index 3b9f06290c..d56f31c298 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_segmentation.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_tables.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_tables.py index 72a0bb4dbf..caf054d6ce 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_tables.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_tables.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_classification.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_classification.py index 26974de391..2ce62dd893 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_classification.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_extraction.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_extraction.py index 1b5a015bca..6f10293f84 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_extraction.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_sentiment.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_sentiment.py index 754c70ab76..8267bfed54 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_sentiment.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_action_recognition.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_action_recognition.py index c305cf3f6b..fb8ba7fe58 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_action_recognition.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_classification.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_classification.py index 1484267000..58d13acbdf 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_classification.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_object_tracking.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_object_tracking.py index 704d6f4a94..33f1e3a974 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_object_tracking.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/export_evaluated_data_items_config.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/export_evaluated_data_items_config.py index f0de3bb9be..61cd7d5bb3 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/export_evaluated_data_items_config.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/export_evaluated_data_items_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py index 5cf5db1af4..188663febf 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/__init__.py index 5abed234cf..3e8adac0f1 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.image_classification import ImageClassificationPredictionInstance @@ -50,29 +45,18 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = ( "google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1" ) - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/__init__.py index 0aea2a22c7..3c847b4577 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_classification.py index 61cae14768..f17bf55aed 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_object_detection.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_object_detection.py index 5706ce93fb..b88fe7b1bc 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_segmentation.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_segmentation.py index 94d11503e2..5f73c2dbfb 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_classification.py index 9ce199f7be..9774236961 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_extraction.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_extraction.py index d2b885078b..dba8855659 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_extraction.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_sentiment.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_sentiment.py index 7f356a6c57..76e5879fe5 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_sentiment.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_action_recognition.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_action_recognition.py index bceb593d83..70de4f8d56 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_classification.py index 6e7b855ba6..419611b0ba 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_object_tracking.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_object_tracking.py index 016ec4967c..f78e5e28c1 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/params/__init__.py index 9e82654fc5..db4ce361a9 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/__init__.py index b13027e72d..f260b20ce2 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.image_classification import ImageClassificationPredictionParams @@ -47,27 +42,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform.v1beta1.schema.predict.params_v1beta1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/__init__.py index ecba43ffd1..b0522f2fc3 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_classification.py index 214c2951ac..b38e837b3d 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_object_detection.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_object_detection.py index 020ebe77a1..09b1926cc5 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_segmentation.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_segmentation.py index e1c5fae209..c2ffaf3dd4 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_action_recognition.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_action_recognition.py index d963f1a215..e179e49d17 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_classification.py index af27e55208..72132c5140 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_object_tracking.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_object_tracking.py index 0f8648a87b..26abab18f7 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/__init__.py index 70aff7bc4d..218b90c887 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/__init__.py index b4d113904a..645ed9fc84 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.classification import ClassificationPredictionResult @@ -52,29 +47,18 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = ( "google.cloud.aiplatform.v1beta1.schema.predict.prediction_v1beta1" ) - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/__init__.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/__init__.py index 49d33147bd..076175c94c 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/classification.py index 8c5a82e3c1..22cc2afb55 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_object_detection.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_object_detection.py index 78de47da0f..8f84e37c03 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_object_detection.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_segmentation.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_segmentation.py index e1069bc0c1..b600ea8f8b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_segmentation.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_classification.py index 4a0df995b1..b849da12d4 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_regression.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_regression.py index 46ce8dd40c..14d638874b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_regression.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/tabular_regression.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_extraction.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_extraction.py index f525dd6386..d32e1ae1ec 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_extraction.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_sentiment.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_sentiment.py index 85ca3fa85f..acaa807057 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_sentiment.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/time_series_forecasting.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/time_series_forecasting.py index d9a7799c53..c9df559ac2 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/time_series_forecasting.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/time_series_forecasting.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_action_recognition.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_action_recognition.py index e1245a4f71..66e52cc86a 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_action_recognition.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_classification.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_classification.py index 451e2d993c..e178dc2460 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_object_tracking.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_object_tracking.py index c31fff397e..8750728290 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_object_tracking.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/types/video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/__init__.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/__init__.py index 20ff5f96c8..3761e4da6d 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/__init__.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/__init__.py index 08729de15e..8b55fdefe3 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,12 +22,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .types.automl_image_classification import AutoMlImageClassification @@ -69,29 +64,18 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = ( "google.cloud.aiplatform.v1beta1.schema.trainingjob.definition_v1beta1" ) - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/__init__.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/__init__.py index 04238ad005..0f24c3aa01 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_classification.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_classification.py index aa30bf1cab..0a4b69ee84 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_object_detection.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_object_detection.py index 6c363e9a0a..c98b3e14c0 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_object_detection.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_object_detection.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_segmentation.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_segmentation.py index 0a190567aa..e17dea1d97 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_segmentation.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_image_segmentation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_tables.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_tables.py index 5446fd2f0d..4ec4d48892 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_tables.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_tables.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_classification.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_classification.py index e85434595e..bfe621e8d2 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_extraction.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_extraction.py index b7c530fbf8..076c4bc239 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_extraction.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_extraction.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_sentiment.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_sentiment.py index c853f83e09..65ff9d5fc9 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_sentiment.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_text_sentiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_time_series_forecasting.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_time_series_forecasting.py index e7ce5d8db3..1f471d0490 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_time_series_forecasting.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_time_series_forecasting.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_action_recognition.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_action_recognition.py index 807ec63644..f98ebe5f9c 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_action_recognition.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_action_recognition.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_classification.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_classification.py index 3010649dcc..974721cbeb 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_classification.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_classification.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_object_tracking.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_object_tracking.py index 936069d754..87edc8cb0e 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_object_tracking.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/automl_video_object_tracking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/export_evaluated_data_items_config.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/export_evaluated_data_items_config.py index 3395793976..34a182ca72 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/export_evaluated_data_items_config.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/types/export_evaluated_data_items_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/__init__.py b/google/cloud/aiplatform_v1/__init__.py index b28c7f0dd6..6bd0220226 100644 --- a/google/cloud/aiplatform_v1/__init__.py +++ b/google/cloud/aiplatform_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,12 +20,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .services.data_foundry_service import DataFoundryServiceClient @@ -900,6 +895,12 @@ ) from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineRequest from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineResponse +from .types.reasoning_engine_execution_service import ( + CancelAsyncQueryReasoningEngineRequest, +) +from .types.reasoning_engine_execution_service import ( + CancelAsyncQueryReasoningEngineResponse, +) from .types.reasoning_engine_execution_service import QueryReasoningEngineRequest from .types.reasoning_engine_execution_service import QueryReasoningEngineResponse from .types.reasoning_engine_execution_service import StreamQueryReasoningEngineRequest @@ -1148,27 +1149,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform_v1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) @@ -1338,6 +1328,8 @@ def _get_version(dependency_name): "BlurBaselineConfig", "BoolArray", "CachedContent", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", "CancelBatchPredictionJobRequest", "CancelCustomJobRequest", "CancelDataLabelingJobRequest", diff --git a/google/cloud/aiplatform_v1/gapic_metadata.json b/google/cloud/aiplatform_v1/gapic_metadata.json index 7aeb9b5405..df020ac8ac 100644 --- a/google/cloud/aiplatform_v1/gapic_metadata.json +++ b/google/cloud/aiplatform_v1/gapic_metadata.json @@ -4315,6 +4315,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" @@ -4335,6 +4340,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" @@ -4355,6 +4365,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" diff --git a/google/cloud/aiplatform_v1/services/__init__.py b/google/cloud/aiplatform_v1/services/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/google/cloud/aiplatform_v1/services/__init__.py +++ b/google/cloud/aiplatform_v1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/__init__.py b/google/cloud/aiplatform_v1/services/data_foundry_service/__init__.py index a2826e0883..d42b0e688f 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py b/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py index 54c5d7dd22..df9ed33ae9 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -188,7 +188,7 @@ def transport(self) -> DataFoundryServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -402,7 +402,7 @@ async def sample_generate_synthetic_data(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -428,8 +428,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -438,7 +442,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -446,7 +450,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -457,7 +461,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -483,8 +487,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -493,7 +501,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -501,7 +509,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -512,7 +520,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -542,8 +550,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -552,7 +564,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -560,7 +572,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -568,7 +580,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -597,8 +609,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -607,7 +623,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -615,7 +631,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -623,7 +639,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -655,8 +671,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -665,7 +685,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -673,7 +693,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -684,7 +704,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -776,8 +796,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -786,7 +810,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -794,7 +820,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -805,7 +831,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -898,8 +924,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -908,7 +938,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -916,7 +948,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -927,7 +959,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -958,8 +990,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -970,7 +1006,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -978,7 +1016,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -989,7 +1027,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1015,8 +1053,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1025,7 +1067,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1033,7 +1075,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1044,7 +1086,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1070,8 +1112,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1080,7 +1126,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1088,7 +1134,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/client.py b/google/cloud/aiplatform_v1/services/data_foundry_service/client.py index bc0511191c..91d20fe48b 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/client.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,6 +71,7 @@ from .transports.grpc_asyncio import DataFoundryServiceGrpcAsyncIOTransport from .transports.rest import DataFoundryServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncDataFoundryServiceRestTransport @@ -129,7 +130,7 @@ class DataFoundryServiceClient(metaclass=DataFoundryServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -137,7 +138,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -147,6 +148,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -432,7 +437,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -529,7 +534,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -629,7 +634,7 @@ def __init__( self._universe_domain = DataFoundryServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -867,7 +872,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -893,8 +898,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -903,7 +912,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -912,7 +921,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -926,7 +935,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -952,8 +961,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -962,7 +975,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -971,7 +984,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -985,7 +998,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1015,8 +1028,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1025,7 +1042,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1033,7 +1050,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1041,7 +1058,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1070,8 +1087,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1080,7 +1101,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1088,7 +1109,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1096,7 +1117,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1128,8 +1149,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1138,7 +1163,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1147,7 +1172,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1161,7 +1186,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1253,8 +1278,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1263,7 +1292,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1272,7 +1303,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1286,7 +1317,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1379,8 +1410,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1389,7 +1424,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1398,7 +1435,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1412,7 +1449,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1443,8 +1480,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1453,7 +1494,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1462,7 +1505,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1476,7 +1519,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1502,8 +1545,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1512,7 +1559,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1521,7 +1568,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1535,7 +1582,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1561,8 +1608,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1571,7 +1622,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1580,7 +1631,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/README.rst b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/README.rst index a91d4d2ae3..616e07ad3d 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`DataFoundryServiceTransport` is the ABC for all transports. -- public child `DataFoundryServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `DataFoundryServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseDataFoundryServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `DataFoundryServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``DataFoundryServiceTransport`` is the ABC for all transports. + +- public child ``DataFoundryServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``DataFoundryServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseDataFoundryServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``DataFoundryServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/__init__.py index 6ddbc3a77b..1024604f49 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/base.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/base.py index 0f6ab84fbe..fb9c1c6987 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc.py index 5bdf6acf48..152f3b6b2d 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc_asyncio.py index e84f47fa33..bb071ff91a 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest.py index f3a7fb2a37..746ed7e1af 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -459,6 +459,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[DataFoundryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_asyncio.py index 463a35b85b..689c6722d5 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -459,6 +459,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncDataFoundryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_base.py index 639e07b64a..83eaba7d2a 100644 --- a/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/data_foundry_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/__init__.py b/google/cloud/aiplatform_v1/services/dataset_service/__init__.py index 42f97659ee..47469dadfd 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/async_client.py b/google/cloud/aiplatform_v1/services/dataset_service/async_client.py index 46d879d521..94faab9c96 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ def transport(self) -> DatasetServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -370,11 +370,11 @@ async def sample_create_dataset(): ) # Make the request - operation = client.create_dataset(request=request) + operation = await client.create_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -875,11 +875,11 @@ async def sample_delete_dataset(): ) # Make the request - operation = client.delete_dataset(request=request) + operation = await client.delete_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1015,11 +1015,11 @@ async def sample_import_data(): ) # Make the request - operation = client.import_data(request=request) + operation = await client.import_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1155,11 +1155,11 @@ async def sample_export_data(): ) # Make the request - operation = client.export_data(request=request) + operation = await client.export_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1296,11 +1296,11 @@ async def sample_create_dataset_version(): ) # Make the request - operation = client.create_dataset_version(request=request) + operation = await client.create_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1566,11 +1566,11 @@ async def sample_delete_dataset_version(): ) # Make the request - operation = client.delete_dataset_version(request=request) + operation = await client.delete_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1941,11 +1941,11 @@ async def sample_restore_dataset_version(): ) # Make the request - operation = client.restore_dataset_version(request=request) + operation = await client.restore_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2424,11 +2424,11 @@ async def sample_delete_saved_query(): ) # Make the request - operation = client.delete_saved_query(request=request) + operation = await client.delete_saved_query(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2767,7 +2767,7 @@ async def sample_list_annotations(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2793,8 +2793,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2803,7 +2807,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2811,7 +2815,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2822,7 +2826,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2848,8 +2852,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2858,7 +2866,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2866,7 +2874,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2877,7 +2885,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2907,8 +2915,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2917,7 +2929,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2925,7 +2937,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2933,7 +2945,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2962,8 +2974,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2972,7 +2988,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2980,7 +2996,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2988,7 +3004,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3020,8 +3036,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3030,7 +3050,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3038,7 +3058,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3049,7 +3069,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3141,8 +3161,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3151,7 +3175,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3159,7 +3185,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3170,7 +3196,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3263,8 +3289,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3273,7 +3303,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3281,7 +3313,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3292,7 +3324,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3323,8 +3355,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3335,7 +3371,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3343,7 +3381,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3354,7 +3392,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3380,8 +3418,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3390,7 +3432,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3398,7 +3440,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3409,7 +3451,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3435,8 +3477,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3445,7 +3491,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3453,7 +3499,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/dataset_service/client.py b/google/cloud/aiplatform_v1/services/dataset_service/client.py index ec2ffcab17..83188c5037 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/client.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,7 @@ from .transports.grpc_asyncio import DatasetServiceGrpcAsyncIOTransport from .transports.rest import DatasetServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncDatasetServiceRestTransport @@ -146,7 +147,7 @@ class DatasetServiceClient(metaclass=DatasetServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -154,7 +155,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -164,6 +165,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -593,7 +598,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -690,7 +695,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -786,7 +791,7 @@ def __init__( self._universe_domain = DatasetServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3305,7 +3310,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3331,8 +3336,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3341,7 +3350,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3350,7 +3359,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3364,7 +3373,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3390,8 +3399,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3400,7 +3413,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3409,7 +3422,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3423,7 +3436,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3453,8 +3466,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3463,7 +3480,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3471,7 +3488,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3479,7 +3496,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3508,8 +3525,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3518,7 +3539,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3526,7 +3547,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3534,7 +3555,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3566,8 +3587,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3576,7 +3601,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3585,7 +3610,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3599,7 +3624,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3691,8 +3716,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3701,7 +3730,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3710,7 +3741,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3724,7 +3755,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3817,8 +3848,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3827,7 +3862,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3836,7 +3873,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3850,7 +3887,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3881,8 +3918,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3891,7 +3932,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3900,7 +3943,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3914,7 +3957,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3940,8 +3983,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3950,7 +3997,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3959,7 +4006,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3973,7 +4020,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3999,8 +4046,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4009,7 +4060,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4018,7 +4069,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/dataset_service/pagers.py b/google/cloud/aiplatform_v1/services/dataset_service/pagers.py index e23cee90df..6d72df27d2 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/README.rst b/google/cloud/aiplatform_v1/services/dataset_service/transports/README.rst index 3282d37876..ef85e2ac67 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`DatasetServiceTransport` is the ABC for all transports. -- public child `DatasetServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `DatasetServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseDatasetServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `DatasetServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``DatasetServiceTransport`` is the ABC for all transports. + +- public child ``DatasetServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``DatasetServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseDatasetServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``DatasetServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/__init__.py index 508606defe..9a876a0c59 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/base.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/base.py index 6d63373ac0..4a5a956727 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py index baa6b4d9ba..c2c8046f55 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py index 4ecd09f9ff..b964939098 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py index 639effd652..56cdebe515 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1488,6 +1488,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[DatasetServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py index 17fff63566..032df95a13 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1491,6 +1491,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncDatasetServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_base.py index 599ead0a73..034ecca6e8 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__init__.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__init__.py index 1a6e5f48e7..ee5fc900ff 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py index 26640fe511..00b12b6a71 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -232,7 +232,7 @@ def transport(self) -> DeploymentResourcePoolServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -392,11 +392,11 @@ async def sample_create_deployment_resource_pool(): ) # Make the request - operation = client.create_deployment_resource_pool(request=request) + operation = await client.create_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -823,11 +823,11 @@ async def sample_update_deployment_resource_pool(): ) # Make the request - operation = client.update_deployment_resource_pool(request=request) + operation = await client.update_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -980,11 +980,11 @@ async def sample_delete_deployment_resource_pool(): ) # Make the request - operation = client.delete_deployment_resource_pool(request=request) + operation = await client.delete_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1227,7 +1227,7 @@ async def sample_query_deployed_models(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1253,8 +1253,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1263,7 +1267,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1271,7 +1275,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1282,7 +1286,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1308,8 +1312,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1318,7 +1326,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1326,7 +1334,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1337,7 +1345,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1367,8 +1375,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1377,7 +1389,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1385,7 +1397,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1393,7 +1405,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1422,8 +1434,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1432,7 +1448,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1440,7 +1456,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1448,7 +1464,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1480,8 +1496,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1490,7 +1510,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1498,7 +1518,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1509,7 +1529,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1601,8 +1621,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1611,7 +1635,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1619,7 +1645,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1630,7 +1656,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1723,8 +1749,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1733,7 +1763,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1741,7 +1773,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1752,7 +1784,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1783,8 +1815,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1795,7 +1831,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1803,7 +1841,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1814,7 +1852,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1840,8 +1878,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1850,7 +1892,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1858,7 +1900,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1869,7 +1911,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1895,8 +1937,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1905,7 +1951,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1913,7 +1959,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py index 9c59404b0b..88b22be577 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,7 @@ from .transports.grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport from .transports.rest import DeploymentResourcePoolServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncDeploymentResourcePoolServiceRestTransport @@ -147,7 +148,7 @@ class DeploymentResourcePoolServiceClient( """A service that manages the DeploymentResourcePool resource.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -155,7 +156,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -165,6 +166,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -542,7 +547,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -641,7 +646,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -745,7 +750,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1762,7 +1767,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1788,8 +1793,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1798,7 +1807,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1807,7 +1816,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1821,7 +1830,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1847,8 +1856,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1857,7 +1870,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1866,7 +1879,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1880,7 +1893,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1910,8 +1923,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1920,7 +1937,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1928,7 +1945,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1936,7 +1953,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1965,8 +1982,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1975,7 +1996,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1983,7 +2004,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1991,7 +2012,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2023,8 +2044,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2033,7 +2058,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2042,7 +2067,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2056,7 +2081,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2148,8 +2173,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2158,7 +2187,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2167,7 +2198,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2181,7 +2212,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2274,8 +2305,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2284,7 +2319,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2293,7 +2330,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2307,7 +2344,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2338,8 +2375,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2348,7 +2389,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2357,7 +2400,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2371,7 +2414,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2397,8 +2440,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2407,7 +2454,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2416,7 +2463,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2430,7 +2477,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2456,8 +2503,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2466,7 +2517,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2475,7 +2526,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py index 44366d74de..940701f8ac 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/README.rst b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/README.rst index d947efaa15..4a0ec44407 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`DeploymentResourcePoolServiceTransport` is the ABC for all transports. -- public child `DeploymentResourcePoolServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `DeploymentResourcePoolServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseDeploymentResourcePoolServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `DeploymentResourcePoolServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``DeploymentResourcePoolServiceTransport`` is the ABC for all transports. + +- public child ``DeploymentResourcePoolServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``DeploymentResourcePoolServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseDeploymentResourcePoolServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``DeploymentResourcePoolServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py index dad07c12b9..c5296b3c0c 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py index 678831a458..de870f3a37 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py index afb0a660c6..38306694b2 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py index d18db93642..9938099749 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py index 3e1c4c6385..62be0d5e6e 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -754,6 +754,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[DeploymentResourcePoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py index d0de7eb4cf..34fcac2e9a 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -755,6 +755,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncDeploymentResourcePoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.py index 2effba5534..b776f53b48 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/__init__.py b/google/cloud/aiplatform_v1/services/endpoint_service/__init__.py index 820efd7010..d9d6e78fee 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py b/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py index f3a2b094ea..1b5a7125da 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -217,7 +217,7 @@ def transport(self) -> EndpointServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -367,11 +367,11 @@ async def sample_create_endpoint(): ) # Make the request - operation = client.create_endpoint(request=request) + operation = await client.create_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -896,11 +896,11 @@ async def sample_update_endpoint_long_running(): ) # Make the request - operation = client.update_endpoint_long_running(request=request) + operation = await client.update_endpoint_long_running(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1025,11 +1025,11 @@ async def sample_delete_endpoint(): ) # Make the request - operation = client.delete_endpoint(request=request) + operation = await client.delete_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1166,11 +1166,11 @@ async def sample_deploy_model(): ) # Make the request - operation = client.deploy_model(request=request) + operation = await client.deploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1333,11 +1333,11 @@ async def sample_undeploy_model(): ) # Make the request - operation = client.undeploy_model(request=request) + operation = await client.undeploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1497,11 +1497,11 @@ async def sample_mutate_deployed_model(): ) # Make the request - operation = client.mutate_deployed_model(request=request) + operation = await client.mutate_deployed_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1625,7 +1625,7 @@ async def sample_mutate_deployed_model(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1651,8 +1651,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1661,7 +1665,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1669,7 +1673,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1680,7 +1684,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1706,8 +1710,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1716,7 +1724,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1724,7 +1732,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1735,7 +1743,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1765,8 +1773,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1775,7 +1787,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1783,7 +1795,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1791,7 +1803,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1820,8 +1832,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1830,7 +1846,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1838,7 +1854,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1846,7 +1862,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1878,8 +1894,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1888,7 +1908,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1896,7 +1916,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1907,7 +1927,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1999,8 +2019,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2009,7 +2033,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2017,7 +2043,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2028,7 +2054,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2121,8 +2147,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2131,7 +2161,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2139,7 +2171,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2150,7 +2182,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2181,8 +2213,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2193,7 +2229,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2201,7 +2239,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2212,7 +2250,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2238,8 +2276,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2248,7 +2290,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2256,7 +2298,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2267,7 +2309,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2293,8 +2335,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2303,7 +2349,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2311,7 +2357,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/client.py b/google/cloud/aiplatform_v1/services/endpoint_service/client.py index 766cf26442..2564e351d5 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/client.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import EndpointServiceGrpcAsyncIOTransport from .transports.rest import EndpointServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncEndpointServiceRestTransport @@ -138,7 +139,7 @@ class EndpointServiceClient(metaclass=EndpointServiceClientMeta): """A service for managing Vertex AI's Endpoints.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -570,7 +575,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -667,7 +672,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -765,7 +770,7 @@ def __init__( self._universe_domain = EndpointServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2173,7 +2178,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2199,8 +2204,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2209,7 +2218,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2218,7 +2227,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2232,7 +2241,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2258,8 +2267,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2268,7 +2281,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2277,7 +2290,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2291,7 +2304,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2321,8 +2334,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2331,7 +2348,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2339,7 +2356,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2347,7 +2364,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2376,8 +2393,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2386,7 +2407,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2394,7 +2415,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2402,7 +2423,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2434,8 +2455,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2444,7 +2469,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2453,7 +2478,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2467,7 +2492,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2559,8 +2584,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2569,7 +2598,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2578,7 +2609,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2592,7 +2623,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2685,8 +2716,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2695,7 +2730,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2704,7 +2741,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2718,7 +2755,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2749,8 +2786,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2759,7 +2800,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2768,7 +2811,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2782,7 +2825,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2808,8 +2851,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2818,7 +2865,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2827,7 +2874,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2841,7 +2888,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2867,8 +2914,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2877,7 +2928,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2886,7 +2937,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py b/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py index 4bd48bf3a7..bb0f7a9784 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/README.rst b/google/cloud/aiplatform_v1/services/endpoint_service/transports/README.rst index ac4deff521..b5238ac537 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`EndpointServiceTransport` is the ABC for all transports. -- public child `EndpointServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `EndpointServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseEndpointServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `EndpointServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``EndpointServiceTransport`` is the ABC for all transports. + +- public child ``EndpointServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``EndpointServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseEndpointServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``EndpointServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/__init__.py index 77d57ff6c3..be24ac1317 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/base.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/base.py index 901393d915..5e03a4a029 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py index e083f48443..cd9ec230a7 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py index ed45bd1701..66357f19eb 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py index 2f0afe4e52..8abd2b19e5 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -907,6 +907,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[EndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py index 46352cdb44..92ecb78350 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -908,6 +908,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_base.py index 3b21ab9c2b..810a2073a0 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/__init__.py b/google/cloud/aiplatform_v1/services/evaluation_service/__init__.py index f2bfe018de..fc89b4197a 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py b/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py index b814320cc0..13f289f574 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -186,7 +186,7 @@ def transport(self) -> EvaluationServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -390,7 +390,7 @@ async def sample_evaluate_instances(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -416,8 +416,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -426,7 +430,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -434,7 +438,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -445,7 +449,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -471,8 +475,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -481,7 +489,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -489,7 +497,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -500,7 +508,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -530,8 +538,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -540,7 +552,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -548,7 +560,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -556,7 +568,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -585,8 +597,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -595,7 +611,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -603,7 +619,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -611,7 +627,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -643,8 +659,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -653,7 +673,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -661,7 +681,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -672,7 +692,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -764,8 +784,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -774,7 +798,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -782,7 +808,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -793,7 +819,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -886,8 +912,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -896,7 +926,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -904,7 +936,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -915,7 +947,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -946,8 +978,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -958,7 +994,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -966,7 +1004,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -977,7 +1015,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1003,8 +1041,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1013,7 +1055,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1021,7 +1063,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1032,7 +1074,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1058,8 +1100,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1068,7 +1114,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1076,7 +1122,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/client.py b/google/cloud/aiplatform_v1/services/evaluation_service/client.py index 123704dbb7..6bf7d3decf 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/client.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,6 +71,7 @@ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport from .transports.rest import EvaluationServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncEvaluationServiceRestTransport @@ -127,7 +128,7 @@ class EvaluationServiceClient(metaclass=EvaluationServiceClientMeta): """Vertex AI Online Evaluation Service.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -135,7 +136,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -145,6 +146,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -430,7 +435,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -527,7 +532,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -627,7 +632,7 @@ def __init__( self._universe_domain = EvaluationServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -855,7 +860,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -881,8 +886,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -891,7 +900,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -900,7 +909,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -914,7 +923,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -940,8 +949,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -950,7 +963,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -959,7 +972,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -973,7 +986,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1003,8 +1016,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1013,7 +1030,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1021,7 +1038,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1029,7 +1046,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1058,8 +1075,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1068,7 +1089,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1076,7 +1097,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1084,7 +1105,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1116,8 +1137,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1126,7 +1151,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1135,7 +1160,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1149,7 +1174,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1241,8 +1266,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1251,7 +1280,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1260,7 +1291,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1274,7 +1305,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1367,8 +1398,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1377,7 +1412,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1386,7 +1423,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1400,7 +1437,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1431,8 +1468,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1441,7 +1482,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1450,7 +1493,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1464,7 +1507,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1490,8 +1533,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1500,7 +1547,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1509,7 +1556,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1523,7 +1570,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1549,8 +1596,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1559,7 +1610,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1568,7 +1619,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/README.rst b/google/cloud/aiplatform_v1/services/evaluation_service/transports/README.rst index b012f0c5c1..21b6cc6a5f 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`EvaluationServiceTransport` is the ABC for all transports. -- public child `EvaluationServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `EvaluationServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseEvaluationServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `EvaluationServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``EvaluationServiceTransport`` is the ABC for all transports. + +- public child ``EvaluationServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``EvaluationServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseEvaluationServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``EvaluationServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py index 65d8722e27..63e31c93f8 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py index ea412bc6f7..da5860771f 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py index d21fd97cf0..b75378f415 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -189,6 +189,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py index 95d538596c..ae69384da9 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -240,6 +240,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py index b45c38f245..4a9a81d442 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -458,6 +458,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[EvaluationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py index 5d2d4dbafa..2422a28975 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -458,6 +458,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncEvaluationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_base.py index 82c168b089..23b60679f7 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/__init__.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/__init__.py index 73ae18693f..efdeb2be1a 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py index 68b1202243..f39dc0587a 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ def transport(self) -> FeatureOnlineStoreAdminServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -401,11 +401,11 @@ async def sample_create_feature_online_store(): ) # Make the request - operation = client.create_feature_online_store(request=request) + operation = await client.create_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -828,11 +828,11 @@ async def sample_update_feature_online_store(): ) # Make the request - operation = client.update_feature_online_store(request=request) + operation = await client.update_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -993,11 +993,11 @@ async def sample_delete_feature_online_store(): ) # Make the request - operation = client.delete_feature_online_store(request=request) + operation = await client.delete_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1156,11 +1156,11 @@ async def sample_create_feature_view(): ) # Make the request - operation = client.create_feature_view(request=request) + operation = await client.create_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1565,11 +1565,11 @@ async def sample_update_feature_view(): ) # Make the request - operation = client.update_feature_view(request=request) + operation = await client.update_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1727,11 +1727,11 @@ async def sample_delete_feature_view(): ) # Make the request - operation = client.delete_feature_view(request=request) + operation = await client.delete_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2205,7 +2205,7 @@ async def sample_list_feature_view_syncs(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2231,8 +2231,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2241,7 +2245,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2249,7 +2253,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2260,7 +2264,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2286,8 +2290,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2296,7 +2304,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2304,7 +2312,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2315,7 +2323,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2345,8 +2353,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2355,7 +2367,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2363,7 +2375,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2371,7 +2383,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2400,8 +2412,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2410,7 +2426,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2418,7 +2434,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2426,7 +2442,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2458,8 +2474,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2468,7 +2488,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2476,7 +2496,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2487,7 +2507,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2579,8 +2599,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2589,7 +2613,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2597,7 +2623,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2608,7 +2634,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2701,8 +2727,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2711,7 +2741,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2719,7 +2751,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2730,7 +2762,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2761,8 +2793,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2773,7 +2809,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2781,7 +2819,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2792,7 +2830,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2818,8 +2856,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2828,7 +2870,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2836,7 +2878,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2847,7 +2889,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2873,8 +2915,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2883,7 +2929,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2891,7 +2937,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py index df47e201ba..ec107a2c66 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,7 @@ from .transports.grpc_asyncio import FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport from .transports.rest import FeatureOnlineStoreAdminServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncFeatureOnlineStoreAdminServiceRestTransport, @@ -159,7 +160,7 @@ class FeatureOnlineStoreAdminServiceClient( """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -167,7 +168,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -177,6 +178,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -536,7 +541,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -635,7 +640,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -739,7 +744,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2703,7 +2708,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2729,8 +2734,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2739,7 +2748,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2748,7 +2757,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2762,7 +2771,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2788,8 +2797,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2798,7 +2811,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2807,7 +2820,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2821,7 +2834,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2851,8 +2864,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2861,7 +2878,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2869,7 +2886,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2877,7 +2894,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2906,8 +2923,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2916,7 +2937,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2924,7 +2945,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2932,7 +2953,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2964,8 +2985,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2974,7 +2999,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2983,7 +3008,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2997,7 +3022,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3089,8 +3114,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3099,7 +3128,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3108,7 +3139,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3122,7 +3153,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3215,8 +3246,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3225,7 +3260,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3234,7 +3271,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3248,7 +3285,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3279,8 +3316,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3289,7 +3330,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3298,7 +3341,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3312,7 +3355,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3338,8 +3381,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3348,7 +3395,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3357,7 +3404,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3371,7 +3418,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3397,8 +3444,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3407,7 +3458,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3416,7 +3467,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py index 2a34fd35e0..96f44ee5a6 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/README.rst b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/README.rst index 5cba49b63f..083e19db6d 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureOnlineStoreAdminServiceTransport` is the ABC for all transports. -- public child `FeatureOnlineStoreAdminServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureOnlineStoreAdminServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureOnlineStoreAdminServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureOnlineStoreAdminServiceTransport`` is the ABC for all transports. + +- public child ``FeatureOnlineStoreAdminServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureOnlineStoreAdminServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureOnlineStoreAdminServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/__init__.py index 31e263b75e..f9e09b3e01 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/base.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/base.py index 74e8bb4e92..cdd5586f0d 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py index d10fa3b174..08f0f37132 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py index 30b550939a..b332555871 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py index 565c115e71..2518fcd6ed 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1163,6 +1163,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureOnlineStoreAdminServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py index 8e2ea5cdb3..ebe7e338fb 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1166,6 +1166,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureOnlineStoreAdminServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_base.py index 3751ad286d..9446261320 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/__init__.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/__init__.py index 25a187e722..b0b57ddfcd 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py index 00efb7593d..5fe85083b0 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -206,7 +206,7 @@ def transport(self) -> FeatureOnlineStoreServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -741,7 +741,7 @@ async def sample_generate_fetch_access_token(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -767,8 +767,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -777,7 +781,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -785,7 +789,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -796,7 +800,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -822,8 +826,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -832,7 +840,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -840,7 +848,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -851,7 +859,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -881,8 +889,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -891,7 +903,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -899,7 +911,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -907,7 +919,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -936,8 +948,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -946,7 +962,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -954,7 +970,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -962,7 +978,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -994,8 +1010,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1004,7 +1024,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1012,7 +1032,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1023,7 +1043,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1115,8 +1135,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1125,7 +1149,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1133,7 +1159,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1144,7 +1170,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1237,8 +1263,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1247,7 +1277,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1255,7 +1287,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1266,7 +1298,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1297,8 +1329,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1309,7 +1345,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1317,7 +1355,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1328,7 +1366,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1354,8 +1392,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1364,7 +1406,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1372,7 +1414,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1383,7 +1425,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1409,8 +1451,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1419,7 +1465,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1427,7 +1473,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py index 5aa62489c2..bc3de76aa4 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport from .transports.rest import FeatureOnlineStoreServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeatureOnlineStoreServiceRestTransport @@ -134,7 +135,7 @@ class FeatureOnlineStoreServiceClient(metaclass=FeatureOnlineStoreServiceClientM """A service for fetching feature values from the online store.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -142,7 +143,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -152,6 +153,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -461,7 +466,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -560,7 +565,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -662,7 +667,7 @@ def __init__( self._universe_domain = FeatureOnlineStoreServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1216,7 +1221,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1242,8 +1247,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1252,7 +1261,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1261,7 +1270,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1275,7 +1284,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1301,8 +1310,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1311,7 +1324,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1320,7 +1333,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1334,7 +1347,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1364,8 +1377,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1374,7 +1391,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1382,7 +1399,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1390,7 +1407,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1419,8 +1436,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1429,7 +1450,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1437,7 +1458,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1445,7 +1466,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1477,8 +1498,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1487,7 +1512,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1496,7 +1521,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1510,7 +1535,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1602,8 +1627,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1612,7 +1641,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1621,7 +1652,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1635,7 +1666,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1728,8 +1759,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1738,7 +1773,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1747,7 +1784,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1761,7 +1798,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1792,8 +1829,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1802,7 +1843,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1811,7 +1854,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1825,7 +1868,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1851,8 +1894,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1861,7 +1908,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1870,7 +1917,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1884,7 +1931,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1910,8 +1957,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1920,7 +1971,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1929,7 +1980,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/README.rst b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/README.rst index d54aed4f93..52ce0e47e1 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureOnlineStoreServiceTransport` is the ABC for all transports. -- public child `FeatureOnlineStoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureOnlineStoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureOnlineStoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureOnlineStoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureOnlineStoreServiceTransport`` is the ABC for all transports. + +- public child ``FeatureOnlineStoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureOnlineStoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureOnlineStoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureOnlineStoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/__init__.py index 1d96784925..ed629bc991 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/base.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/base.py index 71052c78ed..126afad16e 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py index f290355a59..4ea9270f30 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -189,6 +189,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py index 99a59f02c7..7524921c02 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -240,6 +240,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py index 2bf5722564..302a459f63 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -580,6 +580,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureOnlineStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py index f131ec927a..540eafdb8b 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -580,6 +580,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureOnlineStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_base.py index 3b9f2f22f8..6f2c5115d0 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/__init__.py b/google/cloud/aiplatform_v1/services/feature_registry_service/__init__.py index 6b1b86a740..1e7c2c35d8 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py index 65ef956dee..e48c3afcd3 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -210,7 +210,7 @@ def transport(self) -> FeatureRegistryServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -366,11 +366,11 @@ async def sample_create_feature_group(): ) # Make the request - operation = client.create_feature_group(request=request) + operation = await client.create_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -763,11 +763,11 @@ async def sample_update_feature_group(): ) # Make the request - operation = client.update_feature_group(request=request) + operation = await client.update_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -917,11 +917,11 @@ async def sample_delete_feature_group(): ) # Make the request - operation = client.delete_feature_group(request=request) + operation = await client.delete_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1067,11 +1067,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1233,11 +1233,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1628,11 +1628,11 @@ async def sample_update_feature(): ) # Make the request - operation = client.update_feature(request=request) + operation = await client.update_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1786,11 +1786,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1893,7 +1893,7 @@ async def sample_delete_feature(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1919,8 +1919,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1929,7 +1933,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1937,7 +1941,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1948,7 +1952,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1974,8 +1978,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1984,7 +1992,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1992,7 +2000,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2003,7 +2011,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2033,8 +2041,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2043,7 +2055,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2051,7 +2063,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2059,7 +2071,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2088,8 +2100,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2098,7 +2114,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2106,7 +2122,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2114,7 +2130,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2146,8 +2162,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2156,7 +2176,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2164,7 +2184,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2175,7 +2195,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2267,8 +2287,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2277,7 +2301,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2285,7 +2311,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2296,7 +2322,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2389,8 +2415,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2399,7 +2429,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2407,7 +2439,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2418,7 +2450,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2449,8 +2481,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2461,7 +2497,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2469,7 +2507,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2480,7 +2518,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2506,8 +2544,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2516,7 +2558,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2524,7 +2566,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2535,7 +2577,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2561,8 +2603,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2571,7 +2617,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2579,7 +2625,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/client.py b/google/cloud/aiplatform_v1/services/feature_registry_service/client.py index 113ca24a8f..6915e092d8 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ from .transports.grpc_asyncio import FeatureRegistryServiceGrpcAsyncIOTransport from .transports.rest import FeatureRegistryServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeatureRegistryServiceRestTransport @@ -141,7 +142,7 @@ class FeatureRegistryServiceClient(metaclass=FeatureRegistryServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -492,7 +497,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -591,7 +596,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -691,7 +696,7 @@ def __init__( self._universe_domain = FeatureRegistryServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2367,7 +2372,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2393,8 +2398,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2403,7 +2412,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2412,7 +2421,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2426,7 +2435,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2452,8 +2461,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2462,7 +2475,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2471,7 +2484,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2485,7 +2498,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2515,8 +2528,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2525,7 +2542,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2533,7 +2550,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2541,7 +2558,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2570,8 +2587,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2580,7 +2601,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2588,7 +2609,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2596,7 +2617,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2628,8 +2649,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2638,7 +2663,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2647,7 +2672,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2661,7 +2686,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2753,8 +2778,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2763,7 +2792,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2772,7 +2803,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2786,7 +2817,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2879,8 +2910,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2889,7 +2924,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2898,7 +2935,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2912,7 +2949,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2943,8 +2980,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2953,7 +2994,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2962,7 +3005,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2976,7 +3019,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3002,8 +3045,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3012,7 +3059,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3021,7 +3068,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3035,7 +3082,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3061,8 +3108,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3071,7 +3122,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3080,7 +3131,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py b/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py index 3df24f7f15..847bb57e7d 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/README.rst b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/README.rst index d621059883..4d01ea5b41 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureRegistryServiceTransport` is the ABC for all transports. -- public child `FeatureRegistryServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureRegistryServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureRegistryServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureRegistryServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureRegistryServiceTransport`` is the ABC for all transports. + +- public child ``FeatureRegistryServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureRegistryServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureRegistryServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureRegistryServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/__init__.py index f5ea1cd995..6ebfeef638 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/base.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/base.py index 5a3217c8c8..55520246eb 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py index 808144b92f..c6d99220ff 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -194,6 +194,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py index 78f193547b..10a30a3973 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -245,6 +245,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py index f02a9bf94f..96abce1725 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1033,6 +1033,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py index b029900a45..207aa29206 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1036,6 +1036,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_base.py index 8389f9ba83..a25a89a60a 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/__init__.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/__init__.py index 2b01888ee2..7aef979b68 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py index c3b462a6bf..0ab8c1f56f 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -211,7 +211,7 @@ def transport(self) -> FeaturestoreOnlineServingServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -730,7 +730,7 @@ async def sample_write_feature_values(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -756,8 +756,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -766,7 +770,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -774,7 +778,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -785,7 +789,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -811,8 +815,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -821,7 +829,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -829,7 +837,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -840,7 +848,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -870,8 +878,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -880,7 +892,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -888,7 +900,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -896,7 +908,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -925,8 +937,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -935,7 +951,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -943,7 +959,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -951,7 +967,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -983,8 +999,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -993,7 +1013,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1001,7 +1021,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1012,7 +1032,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1104,8 +1124,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1114,7 +1138,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1122,7 +1148,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1133,7 +1159,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1226,8 +1252,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1236,7 +1266,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1244,7 +1276,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1255,7 +1287,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1286,8 +1318,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1298,7 +1334,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1306,7 +1344,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1317,7 +1355,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1343,8 +1381,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1353,7 +1395,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1361,7 +1403,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1372,7 +1414,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1398,8 +1440,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1408,7 +1454,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1416,7 +1462,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py index d0f66125ff..3fe4755549 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ ) from .transports.rest import FeaturestoreOnlineServingServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncFeaturestoreOnlineServingServiceRestTransport, @@ -141,7 +142,7 @@ class FeaturestoreOnlineServingServiceClient( """A service for serving online feature values.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -472,7 +477,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -569,7 +574,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -673,7 +678,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1213,7 +1218,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1239,8 +1244,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1249,7 +1258,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1258,7 +1267,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1272,7 +1281,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1298,8 +1307,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1308,7 +1321,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1317,7 +1330,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1331,7 +1344,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1361,8 +1374,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1371,7 +1388,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1379,7 +1396,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1387,7 +1404,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1416,8 +1433,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1426,7 +1447,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1434,7 +1455,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1442,7 +1463,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1474,8 +1495,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1484,7 +1509,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1493,7 +1518,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1507,7 +1532,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1599,8 +1624,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1609,7 +1638,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1618,7 +1649,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1632,7 +1663,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1725,8 +1756,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1735,7 +1770,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1744,7 +1781,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1758,7 +1795,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1789,8 +1826,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1799,7 +1840,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1808,7 +1851,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1822,7 +1865,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1848,8 +1891,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1858,7 +1905,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1867,7 +1914,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1881,7 +1928,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1907,8 +1954,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1917,7 +1968,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1926,7 +1977,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/README.rst b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/README.rst index 5399789b7c..63c1c8959d 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeaturestoreOnlineServingServiceTransport` is the ABC for all transports. -- public child `FeaturestoreOnlineServingServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeaturestoreOnlineServingServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeaturestoreOnlineServingServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeaturestoreOnlineServingServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeaturestoreOnlineServingServiceTransport`` is the ABC for all transports. + +- public child ``FeaturestoreOnlineServingServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeaturestoreOnlineServingServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeaturestoreOnlineServingServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeaturestoreOnlineServingServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/__init__.py index c2b0c85800..9430909d8a 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/base.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/base.py index 3a28268832..226fad685d 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py index a08a6a6c08..e9da07d664 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py index b4018bedea..862d2855fd 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py index ebf9b0d601..13c9173198 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -579,6 +579,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeaturestoreOnlineServingServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py index 98d0566dcc..649b69ec97 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -582,6 +582,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeaturestoreOnlineServingServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_base.py index 7cb6b9593c..7a0c2e6669 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/__init__.py b/google/cloud/aiplatform_v1/services/featurestore_service/__init__.py index c709802e45..aec58ce7aa 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py b/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py index ed619bd379..ded443e882 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -213,7 +213,7 @@ def transport(self) -> FeaturestoreServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -365,11 +365,11 @@ async def sample_create_featurestore(): ) # Make the request - operation = client.create_featurestore(request=request) + operation = await client.create_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -764,11 +764,11 @@ async def sample_update_featurestore(): ) # Make the request - operation = client.update_featurestore(request=request) + operation = await client.update_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -921,11 +921,11 @@ async def sample_delete_featurestore(): ) # Make the request - operation = client.delete_featurestore(request=request) + operation = await client.delete_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1072,11 +1072,11 @@ async def sample_create_entity_type(): ) # Make the request - operation = client.create_entity_type(request=request) + operation = await client.create_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1622,11 +1622,11 @@ async def sample_delete_entity_type(): ) # Make the request - operation = client.delete_entity_type(request=request) + operation = await client.delete_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1772,11 +1772,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1938,11 +1938,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2477,11 +2477,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2649,11 +2649,11 @@ async def sample_import_feature_values(): ) # Make the request - operation = client.import_feature_values(request=request) + operation = await client.import_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2799,11 +2799,11 @@ async def sample_batch_read_feature_values(): ) # Make the request - operation = client.batch_read_feature_values(request=request) + operation = await client.batch_read_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2938,11 +2938,11 @@ async def sample_export_feature_values(): ) # Make the request - operation = client.export_feature_values(request=request) + operation = await client.export_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3084,11 +3084,11 @@ async def sample_delete_feature_values(): ) # Make the request - operation = client.delete_feature_values(request=request) + operation = await client.delete_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3391,7 +3391,7 @@ async def sample_search_features(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3417,8 +3417,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3427,7 +3431,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3435,7 +3439,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3446,7 +3450,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3472,8 +3476,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3482,7 +3490,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3490,7 +3498,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3501,7 +3509,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3531,8 +3539,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3541,7 +3553,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3549,7 +3561,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3557,7 +3569,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3586,8 +3598,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3596,7 +3612,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3604,7 +3620,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3612,7 +3628,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3644,8 +3660,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3654,7 +3674,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3662,7 +3682,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3673,7 +3693,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3765,8 +3785,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3775,7 +3799,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3783,7 +3809,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3794,7 +3820,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3887,8 +3913,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3897,7 +3927,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3905,7 +3937,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3916,7 +3948,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3947,8 +3979,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3959,7 +3995,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3967,7 +4005,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3978,7 +4016,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4004,8 +4042,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4014,7 +4056,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4022,7 +4064,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4033,7 +4075,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4059,8 +4101,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4069,7 +4115,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4077,7 +4123,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/client.py b/google/cloud/aiplatform_v1/services/featurestore_service/client.py index dcf1e51c1b..e31786bf50 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,7 @@ from .transports.grpc_asyncio import FeaturestoreServiceGrpcAsyncIOTransport from .transports.rest import FeaturestoreServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeaturestoreServiceRestTransport @@ -144,7 +145,7 @@ class FeaturestoreServiceClient(metaclass=FeaturestoreServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -152,7 +153,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -162,6 +163,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -519,7 +524,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -616,7 +621,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -716,7 +721,7 @@ def __init__( self._universe_domain = FeaturestoreServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3859,7 +3864,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3885,8 +3890,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3895,7 +3904,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3904,7 +3913,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3918,7 +3927,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3944,8 +3953,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3954,7 +3967,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3963,7 +3976,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3977,7 +3990,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4007,8 +4020,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4017,7 +4034,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4025,7 +4042,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4033,7 +4050,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4062,8 +4079,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4072,7 +4093,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4080,7 +4101,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4088,7 +4109,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4120,8 +4141,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4130,7 +4155,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4139,7 +4164,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4153,7 +4178,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4245,8 +4270,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4255,7 +4284,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4264,7 +4295,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4278,7 +4309,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4371,8 +4402,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4381,7 +4416,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4390,7 +4427,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4404,7 +4441,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4435,8 +4472,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4445,7 +4486,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4454,7 +4497,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4468,7 +4511,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4494,8 +4537,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4504,7 +4551,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4513,7 +4560,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4527,7 +4574,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4553,8 +4600,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4563,7 +4614,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4572,7 +4623,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py b/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py index c3e82304f0..5cd065dcae 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/README.rst b/google/cloud/aiplatform_v1/services/featurestore_service/transports/README.rst index ec2e5d8e6e..1b9f16dc30 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeaturestoreServiceTransport` is the ABC for all transports. -- public child `FeaturestoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeaturestoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeaturestoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeaturestoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeaturestoreServiceTransport`` is the ABC for all transports. + +- public child ``FeaturestoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeaturestoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeaturestoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeaturestoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/__init__.py index 81505467c8..d2dfb5dd6f 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/base.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/base.py index c6c97f20ae..7818499d7c 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py index c0631d0614..28ba0c66bd 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py index 0b6ef8e817..148c78c1e9 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py index d3e6aa42de..97f093b0f1 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1609,6 +1609,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeaturestoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py index c609f94c78..da34b4e537 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1612,6 +1612,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeaturestoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_base.py index 4228da1729..f1f73d0ed1 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/__init__.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/__init__.py index e99930ebf4..c51aa9d5dc 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/async_client.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/async_client.py index 19bebec217..8f4a50cdaf 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -201,7 +201,7 @@ def transport(self) -> GenAiCacheServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -911,7 +911,7 @@ async def sample_list_cached_contents(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -937,8 +937,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -947,7 +951,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -955,7 +959,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -966,7 +970,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -992,8 +996,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1002,7 +1010,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1010,7 +1018,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1021,7 +1029,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1051,8 +1059,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1061,7 +1073,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1069,7 +1081,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1077,7 +1089,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1106,8 +1118,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1116,7 +1132,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1124,7 +1140,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1132,7 +1148,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1164,8 +1180,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1174,7 +1194,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1182,7 +1202,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1193,7 +1213,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1285,8 +1305,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1295,7 +1319,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1303,7 +1329,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1314,7 +1340,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1407,8 +1433,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1417,7 +1447,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1425,7 +1457,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1436,7 +1468,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1467,8 +1499,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1479,7 +1515,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1487,7 +1525,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1498,7 +1536,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1524,8 +1562,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1534,7 +1576,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1542,7 +1584,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1553,7 +1595,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1579,8 +1621,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1589,7 +1635,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1597,7 +1643,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/client.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/client.py index 8deb96e615..faac604884 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import GenAiCacheServiceGrpcAsyncIOTransport from .transports.rest import GenAiCacheServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncGenAiCacheServiceRestTransport @@ -136,7 +137,7 @@ class GenAiCacheServiceClient(metaclass=GenAiCacheServiceClientMeta): """Service for managing Vertex AI's CachedContent resource.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -483,7 +488,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -580,7 +585,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -680,7 +685,7 @@ def __init__( self._universe_domain = GenAiCacheServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1401,7 +1406,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1427,8 +1432,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1437,7 +1446,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1446,7 +1455,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1460,7 +1469,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1486,8 +1495,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1496,7 +1509,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1505,7 +1518,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1519,7 +1532,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1549,8 +1562,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1559,7 +1576,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1567,7 +1584,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1575,7 +1592,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1604,8 +1621,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1614,7 +1635,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1622,7 +1643,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1630,7 +1651,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1662,8 +1683,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1672,7 +1697,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1681,7 +1706,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1695,7 +1720,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1787,8 +1812,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1797,7 +1826,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1806,7 +1837,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1820,7 +1851,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1913,8 +1944,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1923,7 +1958,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1932,7 +1969,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1946,7 +1983,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1977,8 +2014,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1987,7 +2028,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1996,7 +2039,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2010,7 +2053,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2036,8 +2079,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2046,7 +2093,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2055,7 +2102,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2069,7 +2116,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2095,8 +2142,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2105,7 +2156,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2114,7 +2165,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/pagers.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/pagers.py index 083a0fa3b9..31bcfdc704 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/README.rst b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/README.rst index 22c94081d3..bda2b5ae08 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`GenAiCacheServiceTransport` is the ABC for all transports. -- public child `GenAiCacheServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `GenAiCacheServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseGenAiCacheServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `GenAiCacheServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``GenAiCacheServiceTransport`` is the ABC for all transports. + +- public child ``GenAiCacheServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``GenAiCacheServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseGenAiCacheServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``GenAiCacheServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/__init__.py index 13ea33cff7..74b98dba41 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/base.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/base.py index 5068713a23..830e8df95d 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc.py index 6b25fa58d3..196f019fc2 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc_asyncio.py index bc940698ae..a219312838 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest.py index 99a1195f05..f1488bc86f 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -655,6 +655,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[GenAiCacheServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_asyncio.py index 1dbc81be84..2963dbd58d 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -655,6 +655,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncGenAiCacheServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_base.py index 6c840c183b..2c9dbc662a 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_cache_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/__init__.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/__init__.py index 5ce83d83aa..b143b04833 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py index 87262e71d0..8483a91acf 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> GenAiTuningServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -841,11 +841,11 @@ async def sample_rebase_tuned_model(): ) # Make the request - operation = client.rebase_tuned_model(request=request) + operation = await client.rebase_tuned_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -948,7 +948,7 @@ async def sample_rebase_tuned_model(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -974,8 +974,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -984,7 +988,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -992,7 +996,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1003,7 +1007,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1029,8 +1033,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1039,7 +1047,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1047,7 +1055,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1058,7 +1066,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1088,8 +1096,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1098,7 +1110,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1106,7 +1118,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1114,7 +1126,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1143,8 +1155,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1153,7 +1169,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1161,7 +1177,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1169,7 +1185,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1201,8 +1217,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1211,7 +1231,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1219,7 +1239,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1230,7 +1250,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1322,8 +1342,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1332,7 +1356,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1340,7 +1366,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1351,7 +1377,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1444,8 +1470,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1454,7 +1484,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1462,7 +1494,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1473,7 +1505,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1504,8 +1536,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1516,7 +1552,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1524,7 +1562,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1535,7 +1573,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1561,8 +1599,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1571,7 +1613,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1579,7 +1621,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1590,7 +1632,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1616,8 +1658,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1626,7 +1672,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1634,7 +1680,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py index a7dba1e309..7ac500de46 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import GenAiTuningServiceGrpcAsyncIOTransport from .transports.rest import GenAiTuningServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncGenAiTuningServiceRestTransport @@ -136,7 +137,7 @@ class GenAiTuningServiceClient(metaclass=GenAiTuningServiceClientMeta): """A service for creating and managing GenAI Tuning Jobs.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -551,7 +556,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -648,7 +653,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -748,7 +753,7 @@ def __init__( self._universe_domain = GenAiTuningServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1500,7 +1505,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1526,8 +1531,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1536,7 +1545,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1545,7 +1554,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1559,7 +1568,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1585,8 +1594,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1595,7 +1608,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1604,7 +1617,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1618,7 +1631,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1648,8 +1661,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1658,7 +1675,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1666,7 +1683,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1674,7 +1691,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1703,8 +1720,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1713,7 +1734,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1721,7 +1742,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1729,7 +1750,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1761,8 +1782,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1771,7 +1796,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1780,7 +1805,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1794,7 +1819,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1886,8 +1911,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1896,7 +1925,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1905,7 +1936,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1919,7 +1950,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2012,8 +2043,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2022,7 +2057,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2031,7 +2068,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2045,7 +2082,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2076,8 +2113,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2086,7 +2127,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2095,7 +2138,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2109,7 +2152,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2135,8 +2178,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2145,7 +2192,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2154,7 +2201,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2168,7 +2215,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2194,8 +2241,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2204,7 +2255,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2213,7 +2264,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py index b50b5dcca6..6db6c275e0 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/README.rst b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/README.rst index 66b7511385..abd0af88e9 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`GenAiTuningServiceTransport` is the ABC for all transports. -- public child `GenAiTuningServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `GenAiTuningServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseGenAiTuningServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `GenAiTuningServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``GenAiTuningServiceTransport`` is the ABC for all transports. + +- public child ``GenAiTuningServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``GenAiTuningServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseGenAiTuningServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``GenAiTuningServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/__init__.py index a24ba52e16..3b91dbf3c2 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/base.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/base.py index 901c5b262f..b830a98066 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py index d27e9ee313..0c67855758 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py index 7b27f6ab7a..be98691203 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py index 0c4e4a836b..4093d987c8 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -652,6 +652,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[GenAiTuningServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py index 5d64547d39..5eccbe9e8e 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -653,6 +653,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncGenAiTuningServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_base.py index 77a742039b..a52468d970 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/__init__.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/__init__.py index 0cde92313e..87ec9b5193 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py index 18ac885345..dbf92136a4 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> IndexEndpointServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -360,11 +360,11 @@ async def sample_create_index_endpoint(): ) # Make the request - operation = client.create_index_endpoint(request=request) + operation = await client.create_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -870,11 +870,11 @@ async def sample_delete_index_endpoint(): ) # Make the request - operation = client.delete_index_endpoint(request=request) + operation = await client.delete_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1014,11 +1014,11 @@ async def sample_deploy_index(): ) # Make the request - operation = client.deploy_index(request=request) + operation = await client.deploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1157,11 +1157,11 @@ async def sample_undeploy_index(): ) # Make the request - operation = client.undeploy_index(request=request) + operation = await client.undeploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1303,11 +1303,11 @@ async def sample_mutate_deployed_index(): ) # Make the request - operation = client.mutate_deployed_index(request=request) + operation = await client.mutate_deployed_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1413,7 +1413,7 @@ async def sample_mutate_deployed_index(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1439,8 +1439,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1449,7 +1453,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1457,7 +1461,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1468,7 +1472,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1494,8 +1498,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1504,7 +1512,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1512,7 +1520,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1523,7 +1531,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1553,8 +1561,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1563,7 +1575,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1571,7 +1583,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1579,7 +1591,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1608,8 +1620,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1618,7 +1634,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1626,7 +1642,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1634,7 +1650,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1666,8 +1682,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1676,7 +1696,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1684,7 +1704,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1695,7 +1715,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1787,8 +1807,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1797,7 +1821,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1805,7 +1831,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1816,7 +1842,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1909,8 +1935,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1919,7 +1949,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1927,7 +1959,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1938,7 +1970,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1969,8 +2001,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1981,7 +2017,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1989,7 +2027,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2000,7 +2038,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2026,8 +2064,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2036,7 +2078,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2044,7 +2086,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2055,7 +2097,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2081,8 +2123,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2091,7 +2137,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2099,7 +2145,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py index b67a668a9f..71546a6d77 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import IndexEndpointServiceGrpcAsyncIOTransport from .transports.rest import IndexEndpointServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncIndexEndpointServiceRestTransport @@ -138,7 +139,7 @@ class IndexEndpointServiceClient(metaclass=IndexEndpointServiceClientMeta): """A service for managing Vertex AI's IndexEndpoints.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -507,7 +512,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -604,7 +609,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -704,7 +709,7 @@ def __init__( self._universe_domain = IndexEndpointServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1912,7 +1917,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1938,8 +1943,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1948,7 +1957,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1957,7 +1966,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1971,7 +1980,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1997,8 +2006,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2007,7 +2020,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2016,7 +2029,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2030,7 +2043,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2060,8 +2073,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2070,7 +2087,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2078,7 +2095,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2086,7 +2103,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2115,8 +2132,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2125,7 +2146,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2133,7 +2154,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2141,7 +2162,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2173,8 +2194,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2183,7 +2208,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2192,7 +2217,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2206,7 +2231,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2298,8 +2323,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2308,7 +2337,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2317,7 +2348,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2331,7 +2362,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2424,8 +2455,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2434,7 +2469,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2443,7 +2480,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2457,7 +2494,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2488,8 +2525,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2498,7 +2539,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2507,7 +2550,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2521,7 +2564,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2547,8 +2590,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2557,7 +2604,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2566,7 +2613,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2580,7 +2627,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2606,8 +2653,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2616,7 +2667,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2625,7 +2676,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py index ce0894c9a7..b59c4ebee7 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/README.rst b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/README.rst index e52ec8d550..dedeae855f 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`IndexEndpointServiceTransport` is the ABC for all transports. -- public child `IndexEndpointServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `IndexEndpointServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseIndexEndpointServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `IndexEndpointServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``IndexEndpointServiceTransport`` is the ABC for all transports. + +- public child ``IndexEndpointServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``IndexEndpointServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseIndexEndpointServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``IndexEndpointServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/__init__.py index 9026c2c90d..7e4c26dd88 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/base.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/base.py index 02a248601e..37cd26dcd2 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py index 8fe97d578b..8d0641015a 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py index cd95a791fe..9a96d6070e 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py index 971b0614c4..ee1acab0ae 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -862,6 +862,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[IndexEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py index 015ca51aa4..ad17640fd7 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -863,6 +863,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncIndexEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_base.py index 1104824ad0..6a815085cc 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_service/__init__.py b/google/cloud/aiplatform_v1/services/index_service/__init__.py index e9750e7565..e788091445 100644 --- a/google/cloud/aiplatform_v1/services/index_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/index_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_service/async_client.py b/google/cloud/aiplatform_v1/services/index_service/async_client.py index 287ded362b..1bc951d03e 100644 --- a/google/cloud/aiplatform_v1/services/index_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/index_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ def transport(self) -> IndexServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -349,11 +349,11 @@ async def sample_create_index(): ) # Make the request - operation = client.create_index(request=request) + operation = await client.create_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -727,11 +727,11 @@ async def sample_update_index(): ) # Make the request - operation = client.update_index(request=request) + operation = await client.update_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -867,11 +867,11 @@ async def sample_delete_index(): ) # Make the request - operation = client.delete_index(request=request) + operation = await client.delete_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1143,7 +1143,7 @@ async def sample_remove_datapoints(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1169,8 +1169,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1179,7 +1183,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1187,7 +1191,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1198,7 +1202,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1224,8 +1228,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1234,7 +1242,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1242,7 +1250,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1253,7 +1261,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1283,8 +1291,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1293,7 +1305,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1301,7 +1313,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1309,7 +1321,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1338,8 +1350,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1348,7 +1364,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1356,7 +1372,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1364,7 +1380,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1396,8 +1412,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1406,7 +1426,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1414,7 +1434,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1425,7 +1445,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1517,8 +1537,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1527,7 +1551,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1535,7 +1561,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1546,7 +1572,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1639,8 +1665,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1649,7 +1679,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1657,7 +1689,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1668,7 +1700,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1699,8 +1731,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1711,7 +1747,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1719,7 +1757,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1730,7 +1768,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1756,8 +1794,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1766,7 +1808,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1774,7 +1816,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1785,7 +1827,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1811,8 +1853,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1821,7 +1867,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1829,7 +1875,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/index_service/client.py b/google/cloud/aiplatform_v1/services/index_service/client.py index 09b22de5d9..ea620ac173 100644 --- a/google/cloud/aiplatform_v1/services/index_service/client.py +++ b/google/cloud/aiplatform_v1/services/index_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ from .transports.grpc_asyncio import IndexServiceGrpcAsyncIOTransport from .transports.rest import IndexServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncIndexServiceRestTransport @@ -139,7 +140,7 @@ class IndexServiceClient(metaclass=IndexServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -147,7 +148,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -157,6 +158,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -486,7 +491,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -583,7 +588,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -679,7 +684,7 @@ def __init__( self._universe_domain = IndexServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1627,7 +1632,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1653,8 +1658,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1663,7 +1672,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1672,7 +1681,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1686,7 +1695,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1712,8 +1721,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1722,7 +1735,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1731,7 +1744,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1745,7 +1758,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1775,8 +1788,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1785,7 +1802,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1793,7 +1810,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1801,7 +1818,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1830,8 +1847,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1840,7 +1861,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1848,7 +1869,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1856,7 +1877,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1888,8 +1909,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1898,7 +1923,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1907,7 +1932,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1921,7 +1946,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2013,8 +2038,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2023,7 +2052,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2032,7 +2063,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2046,7 +2077,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2139,8 +2170,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2149,7 +2184,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2158,7 +2195,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2172,7 +2209,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2203,8 +2240,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2213,7 +2254,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2222,7 +2265,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2236,7 +2279,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2262,8 +2305,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2272,7 +2319,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2281,7 +2328,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2295,7 +2342,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2321,8 +2368,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2331,7 +2382,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2340,7 +2391,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/index_service/pagers.py b/google/cloud/aiplatform_v1/services/index_service/pagers.py index 34df5adebe..f3ee7f23b3 100644 --- a/google/cloud/aiplatform_v1/services/index_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/index_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/README.rst b/google/cloud/aiplatform_v1/services/index_service/transports/README.rst index 7b077a4f65..ab6e98844e 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/index_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`IndexServiceTransport` is the ABC for all transports. -- public child `IndexServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `IndexServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseIndexServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `IndexServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``IndexServiceTransport`` is the ABC for all transports. + +- public child ``IndexServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``IndexServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseIndexServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``IndexServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/index_service/transports/__init__.py index 7e67aeafd7..ad680c5ec1 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/base.py b/google/cloud/aiplatform_v1/services/index_service/transports/base.py index 5dd9cd7775..20f436c2aa 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py index 5aa1afb6c7..ae4b1e09c4 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py index bb6419019e..9067a17a6a 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/rest.py b/google/cloud/aiplatform_v1/services/index_service/transports/rest.py index aac621ff0f..e51e58b054 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -793,6 +793,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[IndexServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py index aa82cc32a7..fe8349622f 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -794,6 +794,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncIndexServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/index_service/transports/rest_base.py index 30d09701db..40336e5c4d 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/job_service/__init__.py b/google/cloud/aiplatform_v1/services/job_service/__init__.py index 89e72b6794..bc3111e704 100644 --- a/google/cloud/aiplatform_v1/services/job_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/job_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/job_service/async_client.py b/google/cloud/aiplatform_v1/services/job_service/async_client.py index 7692ce2451..6e4922d525 100644 --- a/google/cloud/aiplatform_v1/services/job_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/job_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -275,7 +275,7 @@ def transport(self) -> JobServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -793,11 +793,11 @@ async def sample_delete_custom_job(): ) # Make the request - operation = client.delete_custom_job(request=request) + operation = await client.delete_custom_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1407,11 +1407,11 @@ async def sample_delete_data_labeling_job(): ) # Make the request - operation = client.delete_data_labeling_job(request=request) + operation = await client.delete_data_labeling_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2028,11 +2028,11 @@ async def sample_delete_hyperparameter_tuning_job(): ) # Make the request - operation = client.delete_hyperparameter_tuning_job(request=request) + operation = await client.delete_hyperparameter_tuning_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2642,11 +2642,11 @@ async def sample_delete_nas_job(): ) # Make the request - operation = client.delete_nas_job(request=request) + operation = await client.delete_nas_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3516,11 +3516,11 @@ async def sample_delete_batch_prediction_job(): ) # Make the request - operation = client.delete_batch_prediction_job(request=request) + operation = await client.delete_batch_prediction_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4311,11 +4311,11 @@ async def sample_update_model_deployment_monitoring_job(): ) # Make the request - operation = client.update_model_deployment_monitoring_job(request=request) + operation = await client.update_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4483,11 +4483,11 @@ async def sample_delete_model_deployment_monitoring_job(): ) # Make the request - operation = client.delete_model_deployment_monitoring_job(request=request) + operation = await client.delete_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4802,7 +4802,7 @@ async def sample_resume_model_deployment_monitoring_job(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4828,8 +4828,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4838,7 +4842,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4846,7 +4850,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4857,7 +4861,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4883,8 +4887,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4893,7 +4901,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4901,7 +4909,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4912,7 +4920,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4942,8 +4950,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4952,7 +4964,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4960,7 +4972,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4968,7 +4980,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4997,8 +5009,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5007,7 +5023,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5015,7 +5031,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5023,7 +5039,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5055,8 +5071,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5065,7 +5085,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5073,7 +5093,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5084,7 +5104,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5176,8 +5196,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5186,7 +5210,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5194,7 +5220,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5205,7 +5231,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5298,8 +5324,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5308,7 +5338,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5316,7 +5348,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5327,7 +5359,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5358,8 +5390,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5370,7 +5406,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5378,7 +5416,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5389,7 +5427,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5415,8 +5453,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5425,7 +5467,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5433,7 +5475,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5444,7 +5486,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5470,8 +5512,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5480,7 +5526,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5488,7 +5534,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/job_service/client.py b/google/cloud/aiplatform_v1/services/job_service/client.py index da26b8089b..9f4be01415 100644 --- a/google/cloud/aiplatform_v1/services/job_service/client.py +++ b/google/cloud/aiplatform_v1/services/job_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -110,6 +110,7 @@ from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport from .transports.rest import JobServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncJobServiceRestTransport @@ -164,7 +165,7 @@ class JobServiceClient(metaclass=JobServiceClientMeta): """A service for creating and managing Vertex AI's jobs.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -172,7 +173,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -182,6 +183,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -866,7 +871,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -963,7 +968,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -1059,7 +1064,7 @@ def __init__( self._universe_domain = JobServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -5547,7 +5552,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5573,8 +5578,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5583,7 +5592,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5592,7 +5601,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5606,7 +5615,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5632,8 +5641,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5642,7 +5655,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5651,7 +5664,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5665,7 +5678,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5695,8 +5708,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5705,7 +5722,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5713,7 +5730,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5721,7 +5738,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5750,8 +5767,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5760,7 +5781,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5768,7 +5789,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5776,7 +5797,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5808,8 +5829,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5818,7 +5843,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5827,7 +5852,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5841,7 +5866,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5933,8 +5958,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5943,7 +5972,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5952,7 +5983,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5966,7 +5997,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6059,8 +6090,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6069,7 +6104,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -6078,7 +6115,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6092,7 +6129,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6123,8 +6160,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6133,7 +6174,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -6142,7 +6185,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6156,7 +6199,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6182,8 +6225,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6192,7 +6239,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -6201,7 +6248,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6215,7 +6262,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6241,8 +6288,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6251,7 +6302,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -6260,7 +6311,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/job_service/pagers.py b/google/cloud/aiplatform_v1/services/job_service/pagers.py index 30024d320a..057deca388 100644 --- a/google/cloud/aiplatform_v1/services/job_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/job_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/README.rst b/google/cloud/aiplatform_v1/services/job_service/transports/README.rst index 1d056719ab..fe0800d742 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/job_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`JobServiceTransport` is the ABC for all transports. -- public child `JobServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `JobServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseJobServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `JobServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``JobServiceTransport`` is the ABC for all transports. + +- public child ``JobServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``JobServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseJobServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``JobServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/job_service/transports/__init__.py index 9c065db1e6..0c50c34207 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/base.py b/google/cloud/aiplatform_v1/services/job_service/transports/base.py index bafd938625..c76553e227 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -108,6 +108,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -157,6 +161,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py index 2149526426..1d9f3a4816 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -114,7 +114,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -209,6 +209,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py index 8d19d6ac71..c9dc85edcd 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -120,7 +120,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -260,6 +260,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/rest.py b/google/cloud/aiplatform_v1/services/job_service/transports/rest.py index 02929c3118..7a8f977757 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2168,6 +2168,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[JobServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py index 0cc6a79e45..a7f4aa817e 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2171,6 +2171,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncJobServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/job_service/transports/rest_base.py index c7a8bddf89..58bcca2184 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/__init__.py b/google/cloud/aiplatform_v1/services/llm_utility_service/__init__.py index 794046854e..448ab7a18e 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py b/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py index eda2eca20f..517805e157 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -193,7 +193,7 @@ def transport(self) -> LlmUtilityServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -556,7 +556,7 @@ async def sample_compute_tokens(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -582,8 +582,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -592,7 +596,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -600,7 +604,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -611,7 +615,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -637,8 +641,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -647,7 +655,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -655,7 +663,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -666,7 +674,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -696,8 +704,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -706,7 +718,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -714,7 +726,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -722,7 +734,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -751,8 +763,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -761,7 +777,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -769,7 +785,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -777,7 +793,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -809,8 +825,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -819,7 +839,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -827,7 +847,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -838,7 +858,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -930,8 +950,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -940,7 +964,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -948,7 +974,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -959,7 +985,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1052,8 +1078,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1062,7 +1092,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1070,7 +1102,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1081,7 +1113,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1112,8 +1144,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1124,7 +1160,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1132,7 +1170,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1143,7 +1181,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1169,8 +1207,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1179,7 +1221,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1187,7 +1229,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1198,7 +1240,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1224,8 +1266,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1234,7 +1280,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1242,7 +1288,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/client.py b/google/cloud/aiplatform_v1/services/llm_utility_service/client.py index 19c9bd9c4e..8b99c4defb 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/client.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -74,6 +74,7 @@ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport from .transports.rest import LlmUtilityServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncLlmUtilityServiceRestTransport @@ -130,7 +131,7 @@ class LlmUtilityServiceClient(metaclass=LlmUtilityServiceClientMeta): """Service for LLM related utility functions.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -138,7 +139,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -148,6 +149,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -477,7 +482,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -574,7 +579,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -674,7 +679,7 @@ def __init__( self._universe_domain = LlmUtilityServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1057,7 +1062,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1083,8 +1088,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1093,7 +1102,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1102,7 +1111,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1116,7 +1125,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1142,8 +1151,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1152,7 +1165,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1161,7 +1174,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1175,7 +1188,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1205,8 +1218,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1215,7 +1232,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1223,7 +1240,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1231,7 +1248,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1260,8 +1277,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1270,7 +1291,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1278,7 +1299,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1286,7 +1307,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1318,8 +1339,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1328,7 +1353,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1337,7 +1362,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1351,7 +1376,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1443,8 +1468,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1453,7 +1482,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1462,7 +1493,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1476,7 +1507,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1569,8 +1600,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1579,7 +1614,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1588,7 +1625,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1602,7 +1639,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1633,8 +1670,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1643,7 +1684,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1652,7 +1695,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1666,7 +1709,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1692,8 +1735,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1702,7 +1749,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1711,7 +1758,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1725,7 +1772,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1751,8 +1798,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1761,7 +1812,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1770,7 +1821,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/README.rst b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/README.rst index 83689fda90..d99c067f3e 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`LlmUtilityServiceTransport` is the ABC for all transports. -- public child `LlmUtilityServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `LlmUtilityServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseLlmUtilityServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `LlmUtilityServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``LlmUtilityServiceTransport`` is the ABC for all transports. + +- public child ``LlmUtilityServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``LlmUtilityServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseLlmUtilityServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``LlmUtilityServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/__init__.py index b1dc8c19d3..e3034c1e7e 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/base.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/base.py index c89f5d4401..a6b7445e4f 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py index 286d6e8b4c..280f23042e 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py index 299fa66d8e..e169a712ed 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py index 7acbf2e1af..1a5ae8d95f 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[LlmUtilityServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py index 6525fe12af..ba5b0706c0 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncLlmUtilityServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_base.py index 465640bcae..e77942f5e8 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/match_service/__init__.py b/google/cloud/aiplatform_v1/services/match_service/__init__.py index 418b6338d1..6fc513a0e2 100644 --- a/google/cloud/aiplatform_v1/services/match_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/match_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/match_service/async_client.py b/google/cloud/aiplatform_v1/services/match_service/async_client.py index e001ef9a8a..dc5621316d 100644 --- a/google/cloud/aiplatform_v1/services/match_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/match_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -189,7 +189,7 @@ def transport(self) -> MatchServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -480,7 +480,7 @@ async def sample_read_index_datapoints(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -506,8 +506,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -516,7 +520,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -524,7 +528,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -535,7 +539,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -561,8 +565,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -571,7 +579,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -579,7 +587,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -590,7 +598,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -620,8 +628,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -630,7 +642,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -638,7 +650,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -646,7 +658,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -675,8 +687,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -685,7 +701,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -693,7 +709,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -701,7 +717,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -733,8 +749,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -743,7 +763,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -751,7 +771,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -762,7 +782,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -854,8 +874,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -864,7 +888,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -872,7 +898,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -883,7 +909,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -976,8 +1002,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -986,7 +1016,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -994,7 +1026,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1005,7 +1037,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1036,8 +1068,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1048,7 +1084,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1056,7 +1094,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1067,7 +1105,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1093,8 +1131,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1103,7 +1145,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1111,7 +1153,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1122,7 +1164,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1148,8 +1190,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1158,7 +1204,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1166,7 +1212,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/match_service/client.py b/google/cloud/aiplatform_v1/services/match_service/client.py index 7daece93c9..ca07c94e20 100644 --- a/google/cloud/aiplatform_v1/services/match_service/client.py +++ b/google/cloud/aiplatform_v1/services/match_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ from .transports.grpc_asyncio import MatchServiceGrpcAsyncIOTransport from .transports.rest import MatchServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMatchServiceRestTransport @@ -128,7 +129,7 @@ class MatchServiceClient(metaclass=MatchServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -136,7 +137,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -146,6 +147,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -453,7 +458,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -550,7 +555,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -646,7 +651,7 @@ def __init__( self._universe_domain = MatchServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -959,7 +964,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -985,8 +990,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -995,7 +1004,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1004,7 +1013,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1018,7 +1027,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1044,8 +1053,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1054,7 +1067,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1063,7 +1076,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1077,7 +1090,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1107,8 +1120,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1117,7 +1134,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1125,7 +1142,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1133,7 +1150,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1162,8 +1179,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1172,7 +1193,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1180,7 +1201,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1188,7 +1209,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1220,8 +1241,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1230,7 +1255,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1239,7 +1264,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1253,7 +1278,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1345,8 +1370,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1355,7 +1384,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1364,7 +1395,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1378,7 +1409,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1471,8 +1502,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1481,7 +1516,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1490,7 +1527,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1504,7 +1541,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1535,8 +1572,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1545,7 +1586,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1554,7 +1597,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1568,7 +1611,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1594,8 +1637,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1604,7 +1651,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1613,7 +1660,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1627,7 +1674,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1653,8 +1700,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1663,7 +1714,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1672,7 +1723,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/README.rst b/google/cloud/aiplatform_v1/services/match_service/transports/README.rst index 51465d214e..2587227e2d 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/match_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MatchServiceTransport` is the ABC for all transports. -- public child `MatchServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MatchServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMatchServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MatchServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MatchServiceTransport`` is the ABC for all transports. + +- public child ``MatchServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MatchServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMatchServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MatchServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/match_service/transports/__init__.py index ab63d1e630..aaf638bf25 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/base.py b/google/cloud/aiplatform_v1/services/match_service/transports/base.py index 189946f8be..cc958855b8 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py index d60a2a65a7..321634cde9 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py index 4267207f08..fe172808d8 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/rest.py b/google/cloud/aiplatform_v1/services/match_service/transports/rest.py index c91ef1b767..da660611bd 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MatchServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py index f1612a6a0a..faff5bf8d5 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMatchServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/match_service/transports/rest_base.py index 01b69f1385..14cd46274b 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/__init__.py b/google/cloud/aiplatform_v1/services/metadata_service/__init__.py index 74e9509053..5e52ea7be7 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/async_client.py b/google/cloud/aiplatform_v1/services/metadata_service/async_client.py index 2a26209097..dbfada91cf 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ def transport(self) -> MetadataServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -370,11 +370,11 @@ async def sample_create_metadata_store(): ) # Make the request - operation = client.create_metadata_store(request=request) + operation = await client.create_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -767,11 +767,11 @@ async def sample_delete_metadata_store(): ) # Make the request - operation = client.delete_metadata_store(request=request) + operation = await client.delete_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1398,11 +1398,11 @@ async def sample_delete_artifact(): ) # Make the request - operation = client.delete_artifact(request=request) + operation = await client.delete_artifact(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1533,11 +1533,11 @@ async def sample_purge_artifacts(): ) # Make the request - operation = client.purge_artifacts(request=request) + operation = await client.purge_artifacts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2155,11 +2155,11 @@ async def sample_delete_context(): ) # Make the request - operation = client.delete_context(request=request) + operation = await client.delete_context(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2290,11 +2290,11 @@ async def sample_purge_contexts(): ) # Make the request - operation = client.purge_contexts(request=request) + operation = await client.purge_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3436,11 +3436,11 @@ async def sample_delete_execution(): ) # Make the request - operation = client.delete_execution(request=request) + operation = await client.delete_execution(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3571,11 +3571,11 @@ async def sample_purge_executions(): ) # Make the request - operation = client.purge_executions(request=request) + operation = await client.purge_executions(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4427,7 +4427,7 @@ async def sample_query_artifact_lineage_subgraph(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4453,8 +4453,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4463,7 +4467,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4471,7 +4475,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4482,7 +4486,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4508,8 +4512,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4518,7 +4526,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4526,7 +4534,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4537,7 +4545,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4567,8 +4575,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4577,7 +4589,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4585,7 +4597,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4593,7 +4605,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4622,8 +4634,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4632,7 +4648,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4640,7 +4656,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4648,7 +4664,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4680,8 +4696,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4690,7 +4710,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4698,7 +4718,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4709,7 +4729,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4801,8 +4821,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4811,7 +4835,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4819,7 +4845,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4830,7 +4856,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4923,8 +4949,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4933,7 +4963,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4941,7 +4973,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4952,7 +4984,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4983,8 +5015,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4995,7 +5031,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5003,7 +5041,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5014,7 +5052,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5040,8 +5078,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5050,7 +5092,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5058,7 +5100,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5069,7 +5111,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5095,8 +5137,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5105,7 +5151,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5113,7 +5159,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/metadata_service/client.py b/google/cloud/aiplatform_v1/services/metadata_service/client.py index 182efc1aa2..4ae6495751 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/client.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,6 +92,7 @@ from .transports.grpc_asyncio import MetadataServiceGrpcAsyncIOTransport from .transports.rest import MetadataServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMetadataServiceRestTransport @@ -148,7 +149,7 @@ class MetadataServiceClient(metaclass=MetadataServiceClientMeta): """Service for reading and writing metadata entries.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -156,7 +157,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -166,6 +167,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -569,7 +574,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -666,7 +671,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -764,7 +769,7 @@ def __init__( self._universe_domain = MetadataServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -4909,7 +4914,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4935,8 +4940,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4945,7 +4954,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4954,7 +4963,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4968,7 +4977,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4994,8 +5003,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5004,7 +5017,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5013,7 +5026,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5027,7 +5040,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5057,8 +5070,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5067,7 +5084,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5075,7 +5092,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5083,7 +5100,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5112,8 +5129,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5122,7 +5143,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5130,7 +5151,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5138,7 +5159,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5170,8 +5191,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5180,7 +5205,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5189,7 +5214,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5203,7 +5228,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5295,8 +5320,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5305,7 +5334,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5314,7 +5345,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5328,7 +5359,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5421,8 +5452,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5431,7 +5466,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5440,7 +5477,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5454,7 +5491,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5485,8 +5522,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5495,7 +5536,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5504,7 +5547,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5518,7 +5561,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5544,8 +5587,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5554,7 +5601,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5563,7 +5610,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5577,7 +5624,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5603,8 +5650,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5613,7 +5664,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5622,7 +5673,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/metadata_service/pagers.py b/google/cloud/aiplatform_v1/services/metadata_service/pagers.py index ea4f70ac89..02686c19f1 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/README.rst b/google/cloud/aiplatform_v1/services/metadata_service/transports/README.rst index ff25cadba5..5482aff6ab 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MetadataServiceTransport` is the ABC for all transports. -- public child `MetadataServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MetadataServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMetadataServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MetadataServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MetadataServiceTransport`` is the ABC for all transports. + +- public child ``MetadataServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MetadataServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMetadataServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MetadataServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/__init__.py index e840719c6a..2fd405dfd6 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/base.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/base.py index d481046adb..9c658c208a 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -96,6 +96,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -145,6 +149,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py index 1dd48559c9..721df35131 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -70,7 +70,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -105,7 +105,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -200,6 +200,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py index 4a6d803fd2..7cf229442e 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -111,7 +111,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -251,6 +251,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py index 8be13d5517..6016931ed5 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2237,6 +2237,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MetadataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py index 32b85ae2a4..b3c13e8da4 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2244,6 +2244,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMetadataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_base.py index 43fccf6373..84812158e5 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/migration_service/__init__.py b/google/cloud/aiplatform_v1/services/migration_service/__init__.py index 554bbdcfaf..534d5930db 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/migration_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/migration_service/async_client.py b/google/cloud/aiplatform_v1/services/migration_service/async_client.py index efddaa0c39..ffb814714f 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/migration_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,14 +86,22 @@ class MigrationServiceAsyncClient: parse_annotated_dataset_path = staticmethod( MigrationServiceClient.parse_annotated_dataset_path ) + auto_ml_dataset_path = staticmethod(MigrationServiceClient.auto_ml_dataset_path) + parse_auto_ml_dataset_path = staticmethod( + MigrationServiceClient.parse_auto_ml_dataset_path + ) + auto_ml_model_path = staticmethod(MigrationServiceClient.auto_ml_model_path) + parse_auto_ml_model_path = staticmethod( + MigrationServiceClient.parse_auto_ml_model_path + ) + data_labeling_dataset_path = staticmethod( + MigrationServiceClient.data_labeling_dataset_path + ) + parse_data_labeling_dataset_path = staticmethod( + MigrationServiceClient.parse_data_labeling_dataset_path + ) dataset_path = staticmethod(MigrationServiceClient.dataset_path) parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - dataset_path = staticmethod(MigrationServiceClient.dataset_path) - parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - dataset_path = staticmethod(MigrationServiceClient.dataset_path) - parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - model_path = staticmethod(MigrationServiceClient.model_path) - parse_model_path = staticmethod(MigrationServiceClient.parse_model_path) model_path = staticmethod(MigrationServiceClient.model_path) parse_model_path = staticmethod(MigrationServiceClient.parse_model_path) version_path = staticmethod(MigrationServiceClient.version_path) @@ -208,7 +216,7 @@ def transport(self) -> MigrationServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -499,11 +507,11 @@ async def sample_batch_migrate_resources(): ) # Make the request - operation = client.batch_migrate_resources(request=request) + operation = await client.batch_migrate_resources(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -607,7 +615,7 @@ async def sample_batch_migrate_resources(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -633,8 +641,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -643,7 +655,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -651,7 +663,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -662,7 +674,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -688,8 +700,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -698,7 +714,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -706,7 +722,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -717,7 +733,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -747,8 +763,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -757,7 +777,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -765,7 +785,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -773,7 +793,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -802,8 +822,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -812,7 +836,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -820,7 +844,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -828,7 +852,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -860,8 +884,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -870,7 +898,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -878,7 +906,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -889,7 +917,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -981,8 +1009,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -991,7 +1023,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -999,7 +1033,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1010,7 +1044,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1103,8 +1137,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1113,7 +1151,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1121,7 +1161,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1132,7 +1172,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1163,8 +1203,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1175,7 +1219,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1183,7 +1229,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1194,7 +1240,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1220,8 +1266,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1230,7 +1280,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1238,7 +1288,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1249,7 +1299,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1275,8 +1325,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1285,7 +1339,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1293,7 +1347,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/migration_service/client.py b/google/cloud/aiplatform_v1/services/migration_service/client.py index 074244583d..1ba3c9e28c 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/client.py +++ b/google/cloud/aiplatform_v1/services/migration_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -75,6 +75,7 @@ from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport from .transports.rest import MigrationServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMigrationServiceRestTransport @@ -133,7 +134,7 @@ class MigrationServiceClient(metaclass=MigrationServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -141,7 +142,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -151,6 +152,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -269,12 +274,12 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def dataset_path( + def auto_ml_dataset_path( project: str, location: str, dataset: str, ) -> str: - """Returns a fully-qualified dataset string.""" + """Returns a fully-qualified auto_ml_dataset string.""" return "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, location=location, @@ -282,8 +287,8 @@ def dataset_path( ) @staticmethod - def parse_dataset_path(path: str) -> Dict[str, str]: - """Parses a dataset path into its component segments.""" + def parse_auto_ml_dataset_path(path: str) -> Dict[str, str]: + """Parses a auto_ml_dataset path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", path, @@ -291,19 +296,41 @@ def parse_dataset_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def dataset_path( + def auto_ml_model_path( + project: str, + location: str, + model: str, + ) -> str: + """Returns a fully-qualified auto_ml_model string.""" + return "projects/{project}/locations/{location}/models/{model}".format( + project=project, + location=location, + model=model, + ) + + @staticmethod + def parse_auto_ml_model_path(path: str) -> Dict[str, str]: + """Parses a auto_ml_model path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/models/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def data_labeling_dataset_path( project: str, dataset: str, ) -> str: - """Returns a fully-qualified dataset string.""" + """Returns a fully-qualified data_labeling_dataset string.""" return "projects/{project}/datasets/{dataset}".format( project=project, dataset=dataset, ) @staticmethod - def parse_dataset_path(path: str) -> Dict[str, str]: - """Parses a dataset path into its component segments.""" + def parse_data_labeling_dataset_path(path: str) -> Dict[str, str]: + """Parses a data_labeling_dataset path into its component segments.""" m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) return m.groupdict() if m else {} @@ -351,28 +378,6 @@ def parse_model_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} - @staticmethod - def model_path( - project: str, - location: str, - model: str, - ) -> str: - """Returns a fully-qualified model string.""" - return "projects/{project}/locations/{location}/models/{model}".format( - project=project, - location=location, - model=model, - ) - - @staticmethod - def parse_model_path(path: str) -> Dict[str, str]: - """Parses a model path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/models/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - @staticmethod def version_path( project: str, @@ -585,7 +590,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -682,7 +687,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -780,7 +785,7 @@ def __init__( self._universe_domain = MigrationServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1203,7 +1208,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1229,8 +1234,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1239,7 +1248,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1248,7 +1257,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1262,7 +1271,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1288,8 +1297,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1298,7 +1311,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1307,7 +1320,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1321,7 +1334,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1351,8 +1364,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1361,7 +1378,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1369,7 +1386,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1377,7 +1394,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1406,8 +1423,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1416,7 +1437,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1424,7 +1445,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1432,7 +1453,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1464,8 +1485,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1474,7 +1499,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1483,7 +1508,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1497,7 +1522,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1589,8 +1614,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1599,7 +1628,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1608,7 +1639,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1622,7 +1653,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1715,8 +1746,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1725,7 +1760,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1734,7 +1771,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1748,7 +1785,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1779,8 +1816,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1789,7 +1830,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1798,7 +1841,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1812,7 +1855,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1838,8 +1881,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1848,7 +1895,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1857,7 +1904,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1871,7 +1918,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1897,8 +1944,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1907,7 +1958,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1916,7 +1967,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/migration_service/pagers.py b/google/cloud/aiplatform_v1/services/migration_service/pagers.py index 359b902755..2f281b8054 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/migration_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/README.rst b/google/cloud/aiplatform_v1/services/migration_service/transports/README.rst index ef5e0cb2c8..e7d0f4026c 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MigrationServiceTransport` is the ABC for all transports. -- public child `MigrationServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MigrationServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMigrationServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MigrationServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MigrationServiceTransport`` is the ABC for all transports. + +- public child ``MigrationServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MigrationServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMigrationServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MigrationServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/migration_service/transports/__init__.py index e8dfb59253..6123764b83 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/base.py b/google/cloud/aiplatform_v1/services/migration_service/transports/base.py index 3e22c2cce3..4a7899f0cc 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py index 83106b1a30..81f9dd46d2 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py index a1720a702a..b9141054d0 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py b/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py index 0e57f2a19d..ce58801708 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MigrationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py index f5ccc79485..6cda9c830d 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -518,6 +518,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMigrationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_base.py index bb363db174..6d3ff7ffee 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/__init__.py b/google/cloud/aiplatform_v1/services/model_garden_service/__init__.py index 8c77df19bb..101a1776df 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py b/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py index b41cf9695e..376f951be2 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ def transport(self) -> ModelGardenServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -460,11 +460,11 @@ async def sample_deploy(): ) # Make the request - operation = client.deploy(request=request) + operation = await client.deploy(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -531,7 +531,7 @@ async def sample_deploy(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -557,8 +557,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -567,7 +571,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -575,7 +579,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -586,7 +590,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -612,8 +616,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -622,7 +630,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -630,7 +638,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -641,7 +649,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -671,8 +679,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -681,7 +693,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -689,7 +701,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -697,7 +709,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -726,8 +738,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -736,7 +752,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -744,7 +760,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -752,7 +768,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -784,8 +800,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -794,7 +814,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -802,7 +822,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -813,7 +833,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -905,8 +925,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -915,7 +939,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -923,7 +949,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -934,7 +960,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1027,8 +1053,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1037,7 +1067,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1045,7 +1077,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1056,7 +1088,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1087,8 +1119,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1099,7 +1135,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1107,7 +1145,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1118,7 +1156,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1144,8 +1182,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1154,7 +1196,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1162,7 +1204,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1173,7 +1215,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1199,8 +1241,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1209,7 +1255,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1217,7 +1263,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/client.py b/google/cloud/aiplatform_v1/services/model_garden_service/client.py index 65e8390682..b0a012ce2a 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/client.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -75,6 +75,7 @@ from .transports.grpc_asyncio import ModelGardenServiceGrpcAsyncIOTransport from .transports.rest import ModelGardenServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncModelGardenServiceRestTransport @@ -131,7 +132,7 @@ class ModelGardenServiceClient(metaclass=ModelGardenServiceClientMeta): """The interface of Model Garden Service.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -139,7 +140,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -149,6 +150,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -517,7 +522,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -614,7 +619,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -714,7 +719,7 @@ def __init__( self._universe_domain = ModelGardenServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1066,7 +1071,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1092,8 +1097,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1102,7 +1111,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1111,7 +1120,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1125,7 +1134,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1151,8 +1160,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1161,7 +1174,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1170,7 +1183,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1184,7 +1197,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1214,8 +1227,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1224,7 +1241,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1232,7 +1249,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1240,7 +1257,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1269,8 +1286,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1279,7 +1300,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1287,7 +1308,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1295,7 +1316,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1327,8 +1348,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1337,7 +1362,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1346,7 +1371,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1360,7 +1385,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1452,8 +1477,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1462,7 +1491,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1471,7 +1502,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1485,7 +1516,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1578,8 +1609,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1588,7 +1623,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1597,7 +1634,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1611,7 +1648,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1642,8 +1679,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1652,7 +1693,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1661,7 +1704,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1675,7 +1718,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1701,8 +1744,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1711,7 +1758,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1720,7 +1767,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1734,7 +1781,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1760,8 +1807,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1770,7 +1821,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1779,7 +1830,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/README.rst b/google/cloud/aiplatform_v1/services/model_garden_service/transports/README.rst index 9056265ed7..b3ac6736ab 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ModelGardenServiceTransport` is the ABC for all transports. -- public child `ModelGardenServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ModelGardenServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseModelGardenServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ModelGardenServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ModelGardenServiceTransport`` is the ABC for all transports. + +- public child ``ModelGardenServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ModelGardenServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseModelGardenServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ModelGardenServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/__init__.py index 3a1a431c25..cb5fe19542 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/base.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/base.py index 7650417275..2ecc444aea 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py index 4680ab0617..c4734dce52 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py index 11eb2c610c..eecd42b755 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py index 0480590a29..ef367f2917 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -513,6 +513,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ModelGardenServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py index 8358eb9ca3..0fa85649e9 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -514,6 +514,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncModelGardenServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_base.py index fe184ebd17..28b153a34d 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_service/__init__.py b/google/cloud/aiplatform_v1/services/model_service/__init__.py index aa17eabb4a..31396a3232 100644 --- a/google/cloud/aiplatform_v1/services/model_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/model_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_service/async_client.py b/google/cloud/aiplatform_v1/services/model_service/async_client.py index 51d7a27d33..3a1069083a 100644 --- a/google/cloud/aiplatform_v1/services/model_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/model_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -219,7 +219,7 @@ def transport(self) -> ModelServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -366,11 +366,11 @@ async def sample_upload_model(): ) # Make the request - operation = client.upload_model(request=request) + operation = await client.upload_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1157,11 +1157,11 @@ async def sample_update_explanation_dataset(): ) # Make the request - operation = client.update_explanation_dataset(request=request) + operation = await client.update_explanation_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1291,11 +1291,11 @@ async def sample_delete_model(): ) # Make the request - operation = client.delete_model(request=request) + operation = await client.delete_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1432,11 +1432,11 @@ async def sample_delete_model_version(): ) # Make the request - operation = client.delete_model_version(request=request) + operation = await client.delete_model_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1708,11 +1708,11 @@ async def sample_export_model(): ) # Make the request - operation = client.export_model(request=request) + operation = await client.export_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1855,11 +1855,11 @@ async def sample_copy_model(): ) # Make the request - operation = client.copy_model(request=request) + operation = await client.copy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2833,7 +2833,7 @@ async def sample_list_model_evaluation_slices(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2859,8 +2859,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2869,7 +2873,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2877,7 +2881,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2888,7 +2892,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2914,8 +2918,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2924,7 +2932,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2932,7 +2940,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2943,7 +2951,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2973,8 +2981,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2983,7 +2995,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2991,7 +3003,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2999,7 +3011,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3028,8 +3040,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3038,7 +3054,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3046,7 +3062,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3054,7 +3070,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3086,8 +3102,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3096,7 +3116,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3104,7 +3124,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3115,7 +3135,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3207,8 +3227,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3217,7 +3241,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3225,7 +3251,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3236,7 +3262,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3329,8 +3355,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3339,7 +3369,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3347,7 +3379,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3358,7 +3390,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3389,8 +3421,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3401,7 +3437,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3409,7 +3447,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3420,7 +3458,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3446,8 +3484,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3456,7 +3498,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3464,7 +3506,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3475,7 +3517,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3501,8 +3543,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3511,7 +3557,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3519,7 +3565,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/model_service/client.py b/google/cloud/aiplatform_v1/services/model_service/client.py index 92a1184722..1af0e21fd7 100644 --- a/google/cloud/aiplatform_v1/services/model_service/client.py +++ b/google/cloud/aiplatform_v1/services/model_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,7 @@ from .transports.grpc_asyncio import ModelServiceGrpcAsyncIOTransport from .transports.rest import ModelServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncModelServiceRestTransport @@ -142,7 +143,7 @@ class ModelServiceClient(metaclass=ModelServiceClientMeta): """A service for managing Vertex AI's machine learning Models.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -150,7 +151,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -160,6 +161,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -583,7 +588,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -680,7 +685,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -776,7 +781,7 @@ def __init__( self._universe_domain = ModelServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3371,7 +3376,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3397,8 +3402,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3407,7 +3416,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3416,7 +3425,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3430,7 +3439,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3456,8 +3465,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3466,7 +3479,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3475,7 +3488,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3489,7 +3502,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3519,8 +3532,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3529,7 +3546,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3537,7 +3554,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3545,7 +3562,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3574,8 +3591,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3584,7 +3605,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3592,7 +3613,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3600,7 +3621,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3632,8 +3653,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3642,7 +3667,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3651,7 +3676,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3665,7 +3690,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3757,8 +3782,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3767,7 +3796,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3776,7 +3807,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3790,7 +3821,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3883,8 +3914,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3893,7 +3928,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3902,7 +3939,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3916,7 +3953,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3947,8 +3984,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3957,7 +3998,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3966,7 +4009,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3980,7 +4023,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4006,8 +4049,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4016,7 +4063,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4025,7 +4072,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4039,7 +4086,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4065,8 +4112,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4075,7 +4126,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4084,7 +4135,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/model_service/pagers.py b/google/cloud/aiplatform_v1/services/model_service/pagers.py index 9041f8288b..053a60b8a3 100644 --- a/google/cloud/aiplatform_v1/services/model_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/model_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/README.rst b/google/cloud/aiplatform_v1/services/model_service/transports/README.rst index 05dddc4c34..a3b272dc76 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/model_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ModelServiceTransport` is the ABC for all transports. -- public child `ModelServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ModelServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseModelServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ModelServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ModelServiceTransport`` is the ABC for all transports. + +- public child ``ModelServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ModelServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseModelServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ModelServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/model_service/transports/__init__.py index 5a7ceaa106..c6a3f8dd13 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/base.py b/google/cloud/aiplatform_v1/services/model_service/transports/base.py index df84dcbee4..c9538b1e99 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py index 41281c06c9..51446617f8 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -195,6 +195,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py index 07d1a01ff5..81b54058a0 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -246,6 +246,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/rest.py b/google/cloud/aiplatform_v1/services/model_service/transports/rest.py index 4db4a0bcf2..4bde6187c3 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1489,6 +1489,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ModelServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py index 7725bf460b..8664c709b9 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1490,6 +1490,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncModelServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/model_service/transports/rest_base.py index 5bc633e237..da11cf742e 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/__init__.py b/google/cloud/aiplatform_v1/services/notebook_service/__init__.py index 2cb87d3354..6ab99c5356 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/async_client.py b/google/cloud/aiplatform_v1/services/notebook_service/async_client.py index d165cc15b0..8a25ce8e7d 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -235,7 +235,7 @@ def transport(self) -> NotebookServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -389,11 +389,11 @@ async def sample_create_notebook_runtime_template(): ) # Make the request - operation = client.create_notebook_runtime_template(request=request) + operation = await client.create_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -791,11 +791,11 @@ async def sample_delete_notebook_runtime_template(): ) # Make the request - operation = client.delete_notebook_runtime_template(request=request) + operation = await client.delete_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1085,11 +1085,11 @@ async def sample_assign_notebook_runtime(): ) # Make the request - operation = client.assign_notebook_runtime(request=request) + operation = await client.assign_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1504,11 +1504,11 @@ async def sample_delete_notebook_runtime(): ) # Make the request - operation = client.delete_notebook_runtime(request=request) + operation = await client.delete_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1644,11 +1644,11 @@ async def sample_upgrade_notebook_runtime(): ) # Make the request - operation = client.upgrade_notebook_runtime(request=request) + operation = await client.upgrade_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1776,11 +1776,11 @@ async def sample_start_notebook_runtime(): ) # Make the request - operation = client.start_notebook_runtime(request=request) + operation = await client.start_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1908,11 +1908,11 @@ async def sample_stop_notebook_runtime(): ) # Make the request - operation = client.stop_notebook_runtime(request=request) + operation = await client.stop_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2050,11 +2050,11 @@ async def sample_create_notebook_execution_job(): ) # Make the request - operation = client.create_notebook_execution_job(request=request) + operation = await client.create_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2440,11 +2440,11 @@ async def sample_delete_notebook_execution_job(): ) # Make the request - operation = client.delete_notebook_execution_job(request=request) + operation = await client.delete_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2544,7 +2544,7 @@ async def sample_delete_notebook_execution_job(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2570,8 +2570,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2580,7 +2584,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2588,7 +2592,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2599,7 +2603,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2625,8 +2629,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2635,7 +2643,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2643,7 +2651,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2654,7 +2662,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2684,8 +2692,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2694,7 +2706,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2702,7 +2714,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2710,7 +2722,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2739,8 +2751,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2749,7 +2765,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2757,7 +2773,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2765,7 +2781,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2797,8 +2813,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2807,7 +2827,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2815,7 +2835,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2826,7 +2846,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2918,8 +2938,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2928,7 +2952,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2936,7 +2962,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2947,7 +2973,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3040,8 +3066,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3050,7 +3080,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3058,7 +3090,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3069,7 +3101,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3100,8 +3132,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3112,7 +3148,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3120,7 +3158,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3131,7 +3169,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3157,8 +3195,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3167,7 +3209,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3175,7 +3217,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3186,7 +3228,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3212,8 +3254,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3222,7 +3268,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3230,7 +3276,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/notebook_service/client.py b/google/cloud/aiplatform_v1/services/notebook_service/client.py index 3ea2d02333..d7803ef22d 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/client.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -94,6 +94,7 @@ from .transports.grpc_asyncio import NotebookServiceGrpcAsyncIOTransport from .transports.rest import NotebookServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncNotebookServiceRestTransport @@ -152,7 +153,7 @@ class NotebookServiceClient(metaclass=NotebookServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -160,7 +161,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -170,6 +171,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -606,7 +611,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -703,7 +708,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -801,7 +806,7 @@ def __init__( self._universe_domain = NotebookServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3107,7 +3112,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3133,8 +3138,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3143,7 +3152,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3152,7 +3161,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3166,7 +3175,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3192,8 +3201,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3202,7 +3215,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3211,7 +3224,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3225,7 +3238,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3255,8 +3268,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3265,7 +3282,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3273,7 +3290,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3281,7 +3298,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3310,8 +3327,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3320,7 +3341,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3328,7 +3349,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3336,7 +3357,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3368,8 +3389,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3378,7 +3403,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3387,7 +3412,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3401,7 +3426,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3493,8 +3518,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3503,7 +3532,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3512,7 +3543,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3526,7 +3557,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3619,8 +3650,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3629,7 +3664,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3638,7 +3675,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3652,7 +3689,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3683,8 +3720,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3693,7 +3734,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3702,7 +3745,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3716,7 +3759,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3742,8 +3785,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3752,7 +3799,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3761,7 +3808,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3775,7 +3822,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3801,8 +3848,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3811,7 +3862,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3820,7 +3871,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/notebook_service/pagers.py b/google/cloud/aiplatform_v1/services/notebook_service/pagers.py index 8e187ee9ea..15d39ed15d 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/README.rst b/google/cloud/aiplatform_v1/services/notebook_service/transports/README.rst index 3fed6e856a..e5b831f665 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`NotebookServiceTransport` is the ABC for all transports. -- public child `NotebookServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `NotebookServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseNotebookServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `NotebookServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``NotebookServiceTransport`` is the ABC for all transports. + +- public child ``NotebookServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``NotebookServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseNotebookServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``NotebookServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/__init__.py index e7b59a5466..448ef1f61b 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/base.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/base.py index 2816915af9..c15e632b9b 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py index f0f291acdc..20eb911dbe 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py index 05fc061f1b..926c9d4d12 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py index 33befc8bea..27d7ec98d9 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1334,6 +1334,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[NotebookServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py index 367d984740..d5a46239eb 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1335,6 +1335,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncNotebookServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_base.py index dfc8c5b32d..a90c24e05f 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/__init__.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/__init__.py index 4101a7ab7e..54e2eb89d2 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py index f819872dff..47ee233ad2 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -232,7 +232,7 @@ def transport(self) -> PersistentResourceServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -385,11 +385,11 @@ async def sample_create_persistent_resource(): ) # Make the request - operation = client.create_persistent_resource(request=request) + operation = await client.create_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -793,11 +793,11 @@ async def sample_delete_persistent_resource(): ) # Make the request - operation = client.delete_persistent_resource(request=request) + operation = await client.delete_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -935,11 +935,11 @@ async def sample_update_persistent_resource(): ) # Make the request - operation = client.update_persistent_resource(request=request) + operation = await client.update_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1083,11 +1083,11 @@ async def sample_reboot_persistent_resource(): ) # Make the request - operation = client.reboot_persistent_resource(request=request) + operation = await client.reboot_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1185,7 +1185,7 @@ async def sample_reboot_persistent_resource(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1211,8 +1211,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1221,7 +1225,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1229,7 +1233,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1240,7 +1244,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1266,8 +1270,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1276,7 +1284,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1284,7 +1292,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1295,7 +1303,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1325,8 +1333,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1335,7 +1347,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1343,7 +1355,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1351,7 +1363,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1380,8 +1392,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1390,7 +1406,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1398,7 +1414,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1406,7 +1422,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1438,8 +1454,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1448,7 +1468,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1456,7 +1476,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1467,7 +1487,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1559,8 +1579,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1569,7 +1593,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1577,7 +1603,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1588,7 +1614,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1681,8 +1707,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1691,7 +1721,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1699,7 +1731,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1710,7 +1742,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1741,8 +1773,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1753,7 +1789,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1761,7 +1799,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1772,7 +1810,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1798,8 +1836,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1808,7 +1850,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1816,7 +1858,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1827,7 +1869,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1853,8 +1895,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1863,7 +1909,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1871,7 +1917,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py index 7e3bd46feb..64b6b46e32 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,7 @@ from .transports.grpc_asyncio import PersistentResourceServiceGrpcAsyncIOTransport from .transports.rest import PersistentResourceServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPersistentResourceServiceRestTransport @@ -145,7 +146,7 @@ class PersistentResourceServiceClient(metaclass=PersistentResourceServiceClientM """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -153,7 +154,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -163,6 +164,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -533,7 +538,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -632,7 +637,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -734,7 +739,7 @@ def __init__( self._universe_domain = PersistentResourceServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1705,7 +1710,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1731,8 +1736,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1741,7 +1750,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1750,7 +1759,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1764,7 +1773,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1790,8 +1799,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1800,7 +1813,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1809,7 +1822,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1823,7 +1836,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1853,8 +1866,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1863,7 +1880,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1871,7 +1888,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1879,7 +1896,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1908,8 +1925,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1918,7 +1939,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1926,7 +1947,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1934,7 +1955,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1966,8 +1987,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1976,7 +2001,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1985,7 +2010,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1999,7 +2024,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2091,8 +2116,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2101,7 +2130,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2110,7 +2141,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2124,7 +2155,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2217,8 +2248,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2227,7 +2262,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2236,7 +2273,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2250,7 +2287,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2281,8 +2318,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2291,7 +2332,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2300,7 +2343,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2314,7 +2357,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2340,8 +2383,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2350,7 +2397,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2359,7 +2406,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2373,7 +2420,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2399,8 +2446,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2409,7 +2460,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2418,7 +2469,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py index 2473690b73..abb2f00938 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/README.rst b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/README.rst index 9123900bcc..48cb30b174 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PersistentResourceServiceTransport` is the ABC for all transports. -- public child `PersistentResourceServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PersistentResourceServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePersistentResourceServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PersistentResourceServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PersistentResourceServiceTransport`` is the ABC for all transports. + +- public child ``PersistentResourceServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PersistentResourceServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePersistentResourceServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PersistentResourceServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/__init__.py index 9e0e3549e6..91066e6327 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/base.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/base.py index 7d6abdf7ed..7f50f38708 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py index 41e071ddb2..9cdedd4a90 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py index 0b33d02173..59632b4f93 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py index 0790b31798..54f2d7cba6 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -750,6 +750,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PersistentResourceServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py index 76f51141ea..94ac02b441 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -751,6 +751,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPersistentResourceServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_base.py index a51b25bcde..734808abb5 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/__init__.py b/google/cloud/aiplatform_v1/services/pipeline_service/__init__.py index 3fb034d0b0..e1d5d515e4 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py b/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py index 8029eff7bc..df39db0cc9 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -234,7 +234,7 @@ def transport(self) -> PipelineServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -762,11 +762,11 @@ async def sample_delete_training_pipeline(): ) # Make the request - operation = client.delete_training_pipeline(request=request) + operation = await client.delete_training_pipeline(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1387,11 +1387,11 @@ async def sample_delete_pipeline_job(): ) # Make the request - operation = client.delete_pipeline_job(request=request) + operation = await client.delete_pipeline_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1528,11 +1528,11 @@ async def sample_batch_delete_pipeline_jobs(): ) # Make the request - operation = client.batch_delete_pipeline_jobs(request=request) + operation = await client.batch_delete_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1789,11 +1789,11 @@ async def sample_batch_cancel_pipeline_jobs(): ) # Make the request - operation = client.batch_cancel_pipeline_jobs(request=request) + operation = await client.batch_cancel_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1895,7 +1895,7 @@ async def sample_batch_cancel_pipeline_jobs(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1921,8 +1921,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1931,7 +1935,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1939,7 +1943,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1950,7 +1954,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1976,8 +1980,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1986,7 +1994,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1994,7 +2002,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2005,7 +2013,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2035,8 +2043,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2045,7 +2057,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2053,7 +2065,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2061,7 +2073,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2090,8 +2102,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2100,7 +2116,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2108,7 +2124,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2116,7 +2132,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2148,8 +2164,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2158,7 +2178,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2166,7 +2186,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2177,7 +2197,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2269,8 +2289,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2279,7 +2303,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2287,7 +2313,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2298,7 +2324,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2391,8 +2417,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2401,7 +2431,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2409,7 +2441,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2420,7 +2452,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2451,8 +2483,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2463,7 +2499,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2471,7 +2509,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2482,7 +2520,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2508,8 +2546,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2518,7 +2560,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2526,7 +2568,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2537,7 +2579,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2563,8 +2605,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2573,7 +2619,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2581,7 +2627,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/client.py b/google/cloud/aiplatform_v1/services/pipeline_service/client.py index 627654278f..ddb78fd5ed 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/client.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,7 @@ from .transports.grpc_asyncio import PipelineServiceGrpcAsyncIOTransport from .transports.rest import PipelineServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPipelineServiceRestTransport @@ -147,7 +148,7 @@ class PipelineServiceClient(metaclass=PipelineServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -155,7 +156,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -165,6 +166,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -673,7 +678,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -770,7 +775,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -868,7 +873,7 @@ def __init__( self._universe_domain = PipelineServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2524,7 +2529,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2550,8 +2555,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2560,7 +2569,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2569,7 +2578,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2583,7 +2592,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2609,8 +2618,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2619,7 +2632,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2628,7 +2641,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2642,7 +2655,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2672,8 +2685,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2682,7 +2699,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2690,7 +2707,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2698,7 +2715,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2727,8 +2744,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2737,7 +2758,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2745,7 +2766,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2753,7 +2774,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2785,8 +2806,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2795,7 +2820,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2804,7 +2829,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2818,7 +2843,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2910,8 +2935,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2920,7 +2949,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2929,7 +2960,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2943,7 +2974,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3036,8 +3067,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3046,7 +3081,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3055,7 +3092,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3069,7 +3106,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3100,8 +3137,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3110,7 +3151,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3119,7 +3162,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3133,7 +3176,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3159,8 +3202,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3169,7 +3216,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3178,7 +3225,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3192,7 +3239,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3218,8 +3265,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3228,7 +3279,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3237,7 +3288,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py b/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py index 7e95e05112..443bda6528 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/README.rst b/google/cloud/aiplatform_v1/services/pipeline_service/transports/README.rst index b5f17d1cea..82250888a7 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PipelineServiceTransport` is the ABC for all transports. -- public child `PipelineServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PipelineServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePipelineServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PipelineServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PipelineServiceTransport`` is the ABC for all transports. + +- public child ``PipelineServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PipelineServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePipelineServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PipelineServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/__init__.py index 516241d5cc..7f2a969df2 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/base.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/base.py index 07c8cea588..34eab69b94 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py index f550576884..ae5dc515c4 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -198,6 +198,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py index 220b305912..1b0f36a689 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -249,6 +249,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py index 744f8720ae..989053a8f6 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1024,6 +1024,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PipelineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py index be972600d2..ff11fcce08 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1025,6 +1025,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPipelineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_base.py index 9df3aa4873..e261b6c5d5 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/__init__.py b/google/cloud/aiplatform_v1/services/prediction_service/__init__.py index 4d2d0a66bb..d337f04e31 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/async_client.py b/google/cloud/aiplatform_v1/services/prediction_service/async_client.py index 6d84abe2c2..4e23e3ad56 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -210,7 +210,7 @@ def transport(self) -> PredictionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -2062,7 +2062,7 @@ async def sample_embed_content(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2088,8 +2088,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2098,7 +2102,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2106,7 +2110,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2117,7 +2121,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2143,8 +2147,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2153,7 +2161,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2161,7 +2169,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2172,7 +2180,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2202,8 +2210,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2212,7 +2224,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2220,7 +2232,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2228,7 +2240,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2257,8 +2269,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2267,7 +2283,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2275,7 +2291,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2283,7 +2299,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2315,8 +2331,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2325,7 +2345,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2333,7 +2353,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2344,7 +2364,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2436,8 +2456,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2446,7 +2470,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2454,7 +2480,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2465,7 +2491,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2558,8 +2584,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2568,7 +2598,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2576,7 +2608,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2587,7 +2619,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2618,8 +2650,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2630,7 +2666,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2638,7 +2676,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2649,7 +2687,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2675,8 +2713,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2685,7 +2727,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2693,7 +2735,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2704,7 +2746,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2730,8 +2772,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2740,7 +2786,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2748,7 +2794,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/prediction_service/client.py b/google/cloud/aiplatform_v1/services/prediction_service/client.py index 3105773487..0e36334f82 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/client.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import PredictionServiceGrpcAsyncIOTransport from .transports.rest import PredictionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPredictionServiceRestTransport @@ -138,7 +139,7 @@ class PredictionServiceClient(metaclass=PredictionServiceClientMeta): """A service for online predictions and explanations.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -551,7 +556,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -648,7 +653,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -748,7 +753,7 @@ def __init__( self._universe_domain = PredictionServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2595,7 +2600,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2621,8 +2626,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2631,7 +2640,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2640,7 +2649,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2654,7 +2663,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2680,8 +2689,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2690,7 +2703,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2699,7 +2712,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2713,7 +2726,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2743,8 +2756,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2753,7 +2770,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2761,7 +2778,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2769,7 +2786,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2798,8 +2815,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2808,7 +2829,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2816,7 +2837,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2824,7 +2845,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2856,8 +2877,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2866,7 +2891,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2875,7 +2900,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2889,7 +2914,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2981,8 +3006,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2991,7 +3020,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3000,7 +3031,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3014,7 +3045,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3107,8 +3138,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3117,7 +3152,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3126,7 +3163,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3140,7 +3177,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3171,8 +3208,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3181,7 +3222,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3190,7 +3233,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3204,7 +3247,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3230,8 +3273,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3240,7 +3287,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3249,7 +3296,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3263,7 +3310,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3289,8 +3336,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3299,7 +3350,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3308,7 +3359,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/README.rst b/google/cloud/aiplatform_v1/services/prediction_service/transports/README.rst index 504aaca0a1..409d7c7b9f 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PredictionServiceTransport` is the ABC for all transports. -- public child `PredictionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PredictionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePredictionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PredictionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PredictionServiceTransport`` is the ABC for all transports. + +- public child ``PredictionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PredictionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePredictionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PredictionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/__init__.py index 11ab649247..c089208274 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/base.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/base.py index fc440cfa44..c5f2685d94 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py index cb8051d284..5c9f67fcc3 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py index 1d75fb3093..7f37b1da62 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py index 30bce45186..c671f8b8e6 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -985,6 +985,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PredictionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py index 1aea553507..ab8a09e8c5 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -988,6 +988,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPredictionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_base.py index 1f29f74687..c93280a98a 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/__init__.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/__init__.py index 34067168e9..1f1d02c66e 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/async_client.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/async_client.py index 1657bda42f..982aa06ade 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -214,7 +214,7 @@ def transport(self) -> ReasoningEngineExecutionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -599,11 +599,11 @@ async def sample_async_query_reasoning_engine(): ) # Make the request - operation = client.async_query_reasoning_engine(request=request) + operation = await client.async_query_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -674,9 +674,106 @@ async def sample_async_query_reasoning_engine(): # Done; return the response. return response + async def cancel_async_query_reasoning_engine( + self, + request: Optional[ + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Cancels an AsyncQueryReasoningEngine operation. + + .. 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 aiplatform_v1 + + async def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = await client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineRequest, dict]]): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + ): + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[ + self._client._transport.cancel_async_query_reasoning_engine + ] + + # 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),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -702,8 +799,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -712,7 +813,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -720,7 +821,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -731,7 +832,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -757,8 +858,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -767,7 +872,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -775,7 +880,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -786,7 +891,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -816,8 +921,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -826,7 +935,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -834,7 +943,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -842,7 +951,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -871,8 +980,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -881,7 +994,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -889,7 +1002,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -897,7 +1010,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -929,8 +1042,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -939,7 +1056,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -947,7 +1064,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -958,7 +1075,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1050,8 +1167,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1060,7 +1181,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1068,7 +1191,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1079,7 +1202,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1172,8 +1295,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1182,7 +1309,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1190,7 +1319,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1201,7 +1330,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1232,8 +1361,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1244,7 +1377,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1252,7 +1387,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1263,7 +1398,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1289,8 +1424,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1299,7 +1438,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1307,7 +1446,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1318,7 +1457,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1344,8 +1483,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1354,7 +1497,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1362,7 +1505,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/client.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/client.py index dafb51beb3..37cadf22c1 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/client.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import ReasoningEngineExecutionServiceGrpcAsyncIOTransport from .transports.rest import ReasoningEngineExecutionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncReasoningEngineExecutionServiceRestTransport, @@ -144,7 +145,7 @@ class ReasoningEngineExecutionServiceClient( """A service for executing queries on Reasoning Engine.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -152,7 +153,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -162,6 +163,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -473,7 +478,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -572,7 +577,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -676,7 +681,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1151,6 +1156,103 @@ def sample_async_query_reasoning_engine(): # Done; return the response. return response + def cancel_async_query_reasoning_engine( + self, + request: Optional[ + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Cancels an AsyncQueryReasoningEngine operation. + + .. 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 aiplatform_v1 + + def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1.ReasoningEngineExecutionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineRequest, dict]): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + ): + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.cancel_async_query_reasoning_engine + ] + + # 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),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self) -> "ReasoningEngineExecutionServiceClient": return self @@ -1166,7 +1268,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1192,8 +1294,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1202,7 +1308,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1211,7 +1317,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1225,7 +1331,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1251,8 +1357,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1261,7 +1371,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1270,7 +1380,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1284,7 +1394,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1314,8 +1424,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1324,7 +1438,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1332,7 +1446,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1340,7 +1454,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1369,8 +1483,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1379,7 +1497,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1387,7 +1505,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1395,7 +1513,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1427,8 +1545,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1437,7 +1559,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1446,7 +1568,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1460,7 +1582,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1552,8 +1674,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1562,7 +1688,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1571,7 +1699,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1585,7 +1713,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1678,8 +1806,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1688,7 +1820,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1697,7 +1831,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1711,7 +1845,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1742,8 +1876,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1752,7 +1890,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1761,7 +1901,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1775,7 +1915,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1801,8 +1941,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1811,7 +1955,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1820,7 +1964,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1834,7 +1978,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1860,8 +2004,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1870,7 +2018,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1879,7 +2027,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/README.rst b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/README.rst index c17f0842b0..06363a9c8b 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ReasoningEngineExecutionServiceTransport` is the ABC for all transports. -- public child `ReasoningEngineExecutionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ReasoningEngineExecutionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseReasoningEngineExecutionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ReasoningEngineExecutionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ReasoningEngineExecutionServiceTransport`` is the ABC for all transports. + +- public child ``ReasoningEngineExecutionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ReasoningEngineExecutionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseReasoningEngineExecutionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ReasoningEngineExecutionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/__init__.py index 8d2c6f6d5a..2e0a97b929 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/base.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/base.py index ef64a8b119..0877d8f22e 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host @@ -158,6 +164,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: gapic_v1.method.wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: gapic_v1.method.wrap_method( self.get_location, default_timeout=None, @@ -254,6 +265,20 @@ def async_query_reasoning_engine( ]: raise NotImplementedError() + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Awaitable[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse + ], + ], + ]: + raise NotImplementedError() + @property def list_operations( self, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc.py index 092271fa04..c713bae55f 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -438,6 +442,38 @@ def async_query_reasoning_engine( ) return self._stubs["async_query_reasoning_engine"] + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + r"""Return a callable for the cancel async query reasoning + engine method over gRPC. + + Cancels an AsyncQueryReasoningEngine operation. + + Returns: + Callable[[~.CancelAsyncQueryReasoningEngineRequest], + ~.CancelAsyncQueryReasoningEngineResponse]: + 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 "cancel_async_query_reasoning_engine" not in self._stubs: + self._stubs["cancel_async_query_reasoning_engine"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1.ReasoningEngineExecutionService/CancelAsyncQueryReasoningEngine", + request_serializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.serialize, + response_deserializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.deserialize, + ) + ) + return self._stubs["cancel_async_query_reasoning_engine"] + def close(self): self._logged_channel.close() diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py index c8f1da0170..429aeed849 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -446,6 +450,40 @@ def async_query_reasoning_engine( ) return self._stubs["async_query_reasoning_engine"] + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + Awaitable[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse + ], + ]: + r"""Return a callable for the cancel async query reasoning + engine method over gRPC. + + Cancels an AsyncQueryReasoningEngine operation. + + Returns: + Callable[[~.CancelAsyncQueryReasoningEngineRequest], + Awaitable[~.CancelAsyncQueryReasoningEngineResponse]]: + 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 "cancel_async_query_reasoning_engine" not in self._stubs: + self._stubs["cancel_async_query_reasoning_engine"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1.ReasoningEngineExecutionService/CancelAsyncQueryReasoningEngine", + request_serializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.serialize, + response_deserializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.deserialize, + ) + ) + return self._stubs["cancel_async_query_reasoning_engine"] + def _prep_wrapped_messages(self, client_info): """Precompute the wrapped methods, overriding the base class method to use async wrappers.""" self._wrapped_methods = { @@ -464,6 +502,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: self._wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: self._wrap_method( self.get_location, default_timeout=None, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest.py index 4934a84cc1..6b338967d8 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,6 +92,14 @@ def post_async_query_reasoning_engine(self, response): logging.log(f"Received response: {response}") return response + def pre_cancel_async_query_reasoning_engine(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_cancel_async_query_reasoning_engine(self, response): + logging.log(f"Received response: {response}") + return response + def pre_query_reasoning_engine(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -163,6 +171,59 @@ def post_async_query_reasoning_engine_with_metadata( """ return response, metadata + def pre_cancel_async_query_reasoning_engine( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineExecutionService server. + """ + return request, metadata + + def post_cancel_async_query_reasoning_engine( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + DEPRECATED. Please use the `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineExecutionService server but before + it is returned to user code. This `post_cancel_async_query_reasoning_engine` interceptor runs + before the `post_cancel_async_query_reasoning_engine_with_metadata` interceptor. + """ + return response + + def post_cancel_async_query_reasoning_engine_with_metadata( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineExecutionService server but before it is returned to user code. + + We recommend only using this `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor in new development instead of the `post_cancel_async_query_reasoning_engine` interceptor. + When both interceptors are used, this `post_cancel_async_query_reasoning_engine_with_metadata` interceptor runs after the + `post_cancel_async_query_reasoning_engine` interceptor. The (possibly modified) response returned by + `post_cancel_async_query_reasoning_engine` will be passed to + `post_cancel_async_query_reasoning_engine_with_metadata`. + """ + return response, metadata + def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, @@ -578,6 +639,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ReasoningEngineExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2755,6 +2822,176 @@ def __call__( ) return resp + class _CancelAsyncQueryReasoningEngine( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine, + ReasoningEngineExecutionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineExecutionServiceRestTransport.CancelAsyncQueryReasoningEngine" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Call the cancel async query + reasoning engine method over HTTP. + + Args: + request (~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + http_options = ( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_http_options() + ) + + request, metadata = ( + self._interceptor.pre_cancel_async_query_reasoning_engine( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceClient.CancelAsyncQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineExecutionServiceRestTransport._CancelAsyncQueryReasoningEngine._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + pb_resp = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + resp + ) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_cancel_async_query_reasoning_engine(resp) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + self._interceptor.post_cancel_async_query_reasoning_engine_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceClient.cancel_async_query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + class _QueryReasoningEngine( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine, ReasoningEngineExecutionServiceRestStub, @@ -3131,6 +3368,17 @@ def async_query_reasoning_engine( # In C++ this would require a dynamic_cast return self._AsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CancelAsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property def query_reasoning_engine( self, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_asyncio.py index 0876c4d1b9..096f988499 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -109,6 +109,14 @@ async def post_async_query_reasoning_engine(self, response): logging.log(f"Received response: {response}") return response + async def pre_cancel_async_query_reasoning_engine(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + async def post_cancel_async_query_reasoning_engine(self, response): + logging.log(f"Received response: {response}") + return response + async def pre_query_reasoning_engine(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -180,6 +188,59 @@ async def post_async_query_reasoning_engine_with_metadata( """ return response, metadata + async def pre_cancel_async_query_reasoning_engine( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineExecutionService server. + """ + return request, metadata + + async def post_cancel_async_query_reasoning_engine( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + DEPRECATED. Please use the `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineExecutionService server but before + it is returned to user code. This `post_cancel_async_query_reasoning_engine` interceptor runs + before the `post_cancel_async_query_reasoning_engine_with_metadata` interceptor. + """ + return response + + async def post_cancel_async_query_reasoning_engine_with_metadata( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineExecutionService server but before it is returned to user code. + + We recommend only using this `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor in new development instead of the `post_cancel_async_query_reasoning_engine` interceptor. + When both interceptors are used, this `post_cancel_async_query_reasoning_engine_with_metadata` interceptor runs after the + `post_cancel_async_query_reasoning_engine` interceptor. The (possibly modified) response returned by + `post_cancel_async_query_reasoning_engine` will be passed to + `post_cancel_async_query_reasoning_engine_with_metadata`. + """ + return response, metadata + async def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, @@ -582,6 +643,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncReasoningEngineExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -620,6 +683,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: self._wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: self._wrap_method( self.get_location, default_timeout=None, @@ -848,6 +916,184 @@ async def __call__( return resp + class _CancelAsyncQueryReasoningEngine( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine, + AsyncReasoningEngineExecutionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineExecutionServiceRestTransport.CancelAsyncQueryReasoningEngine" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + async def __call__( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Call the cancel async query + reasoning engine method over HTTP. + + Args: + request (~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + http_options = ( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_http_options() + ) + + request, metadata = ( + await self._interceptor.pre_cancel_async_query_reasoning_engine( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceClient.CancelAsyncQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineExecutionServiceRestTransport._CancelAsyncQueryReasoningEngine._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + # Return the response + resp = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + pb_resp = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + resp + ) + content = await response.read() + json_format.Parse(content, pb_resp, ignore_unknown_fields=True) + resp = await self._interceptor.post_cancel_async_query_reasoning_engine( + resp + ) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + await self._interceptor.post_cancel_async_query_reasoning_engine_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient.cancel_async_query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + + return resp + class _QueryReasoningEngine( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine, AsyncReasoningEngineExecutionServiceRestStub, @@ -3230,6 +3476,15 @@ def async_query_reasoning_engine( ]: return self._AsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + return self._CancelAsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property def query_reasoning_engine( self, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_base.py index 68ab560759..8119e8ef12 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -162,6 +162,70 @@ def _get_query_params_json(transcoded_request): query_params["$alt"] = "json;enum-encoding=int" return query_params + class _BaseCancelAsyncQueryReasoningEngine: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{name=projects/*/locations/*/reasoningEngines/*}:cancelAsyncQuery", + "body": "*", + }, + { + "method": "post", + "uri": "/v1/{name=reasoningEngines/*}:cancelAsyncQuery", + "body": "*", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], use_integers_for_enums=True + ) + return body + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + use_integers_for_enums=True, + ) + ) + query_params.update( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_unset_required_fields( + query_params + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + class _BaseQueryReasoningEngine: def __hash__(self): # pragma: NO COVER return NotImplementedError("__hash__ must be implemented.") diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/__init__.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/__init__.py index 9bcdc0e3b8..87876db87b 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/async_client.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/async_client.py index 82917f0d20..210ae45c55 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -218,7 +218,7 @@ def transport(self) -> ReasoningEngineServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -371,11 +371,11 @@ async def sample_create_reasoning_engine(): ) # Make the request - operation = client.create_reasoning_engine(request=request) + operation = await client.create_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -761,11 +761,11 @@ async def sample_update_reasoning_engine(): ) # Make the request - operation = client.update_reasoning_engine(request=request) + operation = await client.update_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -901,11 +901,11 @@ async def sample_delete_reasoning_engine(): ) # Make the request - operation = client.delete_reasoning_engine(request=request) + operation = await client.delete_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1007,7 +1007,7 @@ async def sample_delete_reasoning_engine(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1033,8 +1033,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1043,7 +1047,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1051,7 +1055,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1062,7 +1066,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1088,8 +1092,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1098,7 +1106,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1106,7 +1114,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1117,7 +1125,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1147,8 +1155,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1157,7 +1169,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1165,7 +1177,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1173,7 +1185,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1202,8 +1214,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1212,7 +1228,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1220,7 +1236,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1228,7 +1244,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1260,8 +1276,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1270,7 +1290,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1278,7 +1298,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1289,7 +1309,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1381,8 +1401,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1391,7 +1415,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1399,7 +1425,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1410,7 +1436,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1503,8 +1529,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1513,7 +1543,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1521,7 +1553,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1532,7 +1564,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1563,8 +1595,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1575,7 +1611,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1583,7 +1621,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1594,7 +1632,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1620,8 +1658,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1630,7 +1672,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1638,7 +1680,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1649,7 +1691,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1675,8 +1717,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1685,7 +1731,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1693,7 +1739,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/client.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/client.py index 22ac44992f..f645fc94a4 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/client.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,6 +81,7 @@ from .transports.grpc_asyncio import ReasoningEngineServiceGrpcAsyncIOTransport from .transports.rest import ReasoningEngineServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncReasoningEngineServiceRestTransport @@ -137,7 +138,7 @@ class ReasoningEngineServiceClient(metaclass=ReasoningEngineServiceClientMeta): """A service for managing Vertex AI's Reasoning Engines.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -145,7 +146,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -155,6 +156,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -508,7 +513,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -607,7 +612,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -707,7 +712,7 @@ def __init__( self._universe_domain = ReasoningEngineServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1507,7 +1512,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1533,8 +1538,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1543,7 +1552,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1552,7 +1561,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1566,7 +1575,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1592,8 +1601,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1602,7 +1615,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1611,7 +1624,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1625,7 +1638,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1655,8 +1668,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1665,7 +1682,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1673,7 +1690,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1681,7 +1698,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1710,8 +1727,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1720,7 +1741,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1728,7 +1749,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1736,7 +1757,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1768,8 +1789,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1778,7 +1803,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1787,7 +1812,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1801,7 +1826,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1893,8 +1918,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1903,7 +1932,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1912,7 +1943,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1926,7 +1957,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2019,8 +2050,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2029,7 +2064,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2038,7 +2075,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2052,7 +2089,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2083,8 +2120,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2093,7 +2134,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2102,7 +2145,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2116,7 +2159,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2142,8 +2185,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2152,7 +2199,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2161,7 +2208,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2175,7 +2222,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2201,8 +2248,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2211,7 +2262,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2220,7 +2271,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/pagers.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/pagers.py index bc2ed1fdfa..bd1d5e7899 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/README.rst b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/README.rst index aec8aac318..0453d542c5 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ReasoningEngineServiceTransport` is the ABC for all transports. -- public child `ReasoningEngineServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ReasoningEngineServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseReasoningEngineServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ReasoningEngineServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ReasoningEngineServiceTransport`` is the ABC for all transports. + +- public child ``ReasoningEngineServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ReasoningEngineServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseReasoningEngineServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ReasoningEngineServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/__init__.py index 84150e1136..ccc2f20e2c 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/base.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/base.py index aafa4cbbdd..6e0b7badd9 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc.py index 0333e9cd1c..de48f13792 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc_asyncio.py index 79041d1188..5e4045ebc4 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest.py index e28f7a7807..3a4f2bd870 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -690,6 +690,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ReasoningEngineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_asyncio.py index fd449a46b1..8dad4ee547 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncReasoningEngineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_base.py index cbb8f9339d..3832355b19 100644 --- a/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/reasoning_engine_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/__init__.py b/google/cloud/aiplatform_v1/services/schedule_service/__init__.py index 747eaed13f..7f7657bc28 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/async_client.py b/google/cloud/aiplatform_v1/services/schedule_service/async_client.py index 51eeb039cd..ab4e4ebdc9 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -238,7 +238,7 @@ def transport(self) -> ScheduleServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -511,11 +511,11 @@ async def sample_delete_schedule(): ) # Make the request - operation = client.delete_schedule(request=request) + operation = await client.delete_schedule(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1223,7 +1223,7 @@ async def sample_update_schedule(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1249,8 +1249,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1259,7 +1263,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1267,7 +1271,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1278,7 +1282,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1304,8 +1308,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1314,7 +1322,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1322,7 +1330,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1333,7 +1341,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1363,8 +1371,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1373,7 +1385,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1381,7 +1393,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1389,7 +1401,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1418,8 +1430,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1428,7 +1444,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1436,7 +1452,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1444,7 +1460,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1476,8 +1492,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1486,7 +1506,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1494,7 +1514,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1505,7 +1525,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1597,8 +1617,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1607,7 +1631,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1615,7 +1641,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1626,7 +1652,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1719,8 +1745,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1729,7 +1759,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1737,7 +1769,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1748,7 +1780,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1779,8 +1811,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1791,7 +1827,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1799,7 +1837,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1810,7 +1848,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1836,8 +1874,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1846,7 +1888,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1854,7 +1896,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1865,7 +1907,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1891,8 +1933,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1901,7 +1947,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1909,7 +1955,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/schedule_service/client.py b/google/cloud/aiplatform_v1/services/schedule_service/client.py index f985b8d614..645bc78385 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/client.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import ScheduleServiceGrpcAsyncIOTransport from .transports.rest import ScheduleServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncScheduleServiceRestTransport @@ -141,7 +142,7 @@ class ScheduleServiceClient(metaclass=ScheduleServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -711,7 +716,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -808,7 +813,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -906,7 +911,7 @@ def __init__( self._universe_domain = ScheduleServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1897,7 +1902,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1923,8 +1928,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1933,7 +1942,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1942,7 +1951,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1956,7 +1965,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1982,8 +1991,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1992,7 +2005,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2001,7 +2014,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2015,7 +2028,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2045,8 +2058,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2055,7 +2072,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2063,7 +2080,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2071,7 +2088,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2100,8 +2117,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2110,7 +2131,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2118,7 +2139,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2126,7 +2147,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2158,8 +2179,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2168,7 +2193,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2177,7 +2202,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2191,7 +2216,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2283,8 +2308,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2293,7 +2322,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2302,7 +2333,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2316,7 +2347,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2409,8 +2440,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2419,7 +2454,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2428,7 +2465,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2442,7 +2479,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2473,8 +2510,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2483,7 +2524,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2492,7 +2535,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2506,7 +2549,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2532,8 +2575,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2542,7 +2589,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2551,7 +2598,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2565,7 +2612,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2591,8 +2638,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2601,7 +2652,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2610,7 +2661,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/schedule_service/pagers.py b/google/cloud/aiplatform_v1/services/schedule_service/pagers.py index a0176a3a78..9170fda804 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/README.rst b/google/cloud/aiplatform_v1/services/schedule_service/transports/README.rst index e1a2b3ed17..9045ed99c9 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ScheduleServiceTransport` is the ABC for all transports. -- public child `ScheduleServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ScheduleServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseScheduleServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ScheduleServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ScheduleServiceTransport`` is the ABC for all transports. + +- public child ``ScheduleServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ScheduleServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseScheduleServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ScheduleServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/__init__.py index 61dc9643eb..7efc68c2ab 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/base.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/base.py index d56e7d10c0..ffa879e5f1 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py index 96768d6925..8bf50a1636 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -195,6 +195,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py index f8cb44558b..06544aa5e0 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -246,6 +246,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py index 43e84cc647..802f2d5a05 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -720,6 +720,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ScheduleServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py index 7b53e7c598..43f4a7df71 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -721,6 +721,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncScheduleServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_base.py index 0f99d359ef..4d4a7cdd44 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/session_service/__init__.py b/google/cloud/aiplatform_v1/services/session_service/__init__.py index a00026df42..f622ab4cc3 100644 --- a/google/cloud/aiplatform_v1/services/session_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/session_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/session_service/async_client.py b/google/cloud/aiplatform_v1/services/session_service/async_client.py index 8ae7bc9f23..3505ef70ca 100644 --- a/google/cloud/aiplatform_v1/services/session_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/session_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> SessionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -355,11 +355,11 @@ async def sample_create_session(): ) # Make the request - operation = client.create_session(request=request) + operation = await client.create_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -876,11 +876,11 @@ async def sample_delete_session(): ) # Make the request - operation = client.delete_session(request=request) + operation = await client.delete_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1234,7 +1234,7 @@ async def sample_append_event(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1260,8 +1260,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1270,7 +1274,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1278,7 +1282,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1289,7 +1293,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1315,8 +1319,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1325,7 +1333,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1333,7 +1341,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1344,7 +1352,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1374,8 +1382,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1384,7 +1396,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1392,7 +1404,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1400,7 +1412,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1429,8 +1441,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1439,7 +1455,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1447,7 +1463,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1455,7 +1471,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1487,8 +1503,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1497,7 +1517,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1505,7 +1525,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1516,7 +1536,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1608,8 +1628,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1618,7 +1642,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1626,7 +1652,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1637,7 +1663,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1730,8 +1756,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1740,7 +1770,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1748,7 +1780,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1759,7 +1791,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1790,8 +1822,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1802,7 +1838,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1810,7 +1848,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1821,7 +1859,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1847,8 +1885,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1857,7 +1899,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1865,7 +1907,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1876,7 +1918,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1902,8 +1944,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1912,7 +1958,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1920,7 +1966,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/session_service/client.py b/google/cloud/aiplatform_v1/services/session_service/client.py index 04f5d7e016..bdca713ffa 100644 --- a/google/cloud/aiplatform_v1/services/session_service/client.py +++ b/google/cloud/aiplatform_v1/services/session_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import SessionServiceGrpcAsyncIOTransport from .transports.rest import SessionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncSessionServiceRestTransport @@ -138,7 +139,7 @@ class SessionServiceClient(metaclass=SessionServiceClientMeta): """The service that manages Vertex Session related resources.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -513,7 +518,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -610,7 +615,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -706,7 +711,7 @@ def __init__( self._universe_domain = SessionServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1741,7 +1746,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1767,8 +1772,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1777,7 +1786,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1786,7 +1795,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1800,7 +1809,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1826,8 +1835,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1836,7 +1849,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1845,7 +1858,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1859,7 +1872,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1889,8 +1902,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1899,7 +1916,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1907,7 +1924,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1915,7 +1932,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1944,8 +1961,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1954,7 +1975,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1962,7 +1983,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1970,7 +1991,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2002,8 +2023,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2012,7 +2037,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2021,7 +2046,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2035,7 +2060,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2127,8 +2152,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2137,7 +2166,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2146,7 +2177,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2160,7 +2191,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2253,8 +2284,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2263,7 +2298,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2272,7 +2309,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2286,7 +2323,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2317,8 +2354,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2327,7 +2368,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2336,7 +2379,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2350,7 +2393,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2376,8 +2419,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2386,7 +2433,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2395,7 +2442,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2409,7 +2456,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2435,8 +2482,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2445,7 +2496,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2454,7 +2505,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/session_service/pagers.py b/google/cloud/aiplatform_v1/services/session_service/pagers.py index fd893d6b67..341825ac35 100644 --- a/google/cloud/aiplatform_v1/services/session_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/session_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/README.rst b/google/cloud/aiplatform_v1/services/session_service/transports/README.rst index f67320e75a..ec396d9ed4 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/session_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`SessionServiceTransport` is the ABC for all transports. -- public child `SessionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `SessionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseSessionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `SessionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``SessionServiceTransport`` is the ABC for all transports. + +- public child ``SessionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``SessionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseSessionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``SessionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/session_service/transports/__init__.py index d4890abd08..81741f8175 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/base.py b/google/cloud/aiplatform_v1/services/session_service/transports/base.py index 2f7faad965..c1fbefae59 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/session_service/transports/grpc.py index 01455ac2aa..3690c2ceb9 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/session_service/transports/grpc_asyncio.py index 1cf6c0dbf8..e355bc5078 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/rest.py b/google/cloud/aiplatform_v1/services/session_service/transports/rest.py index 7175edf300..f323e49c13 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -795,6 +795,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[SessionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/session_service/transports/rest_asyncio.py index 4fecd41db7..e014c8a315 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -798,6 +798,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncSessionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/session_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/session_service/transports/rest_base.py index f33175d298..78aa285d64 100644 --- a/google/cloud/aiplatform_v1/services/session_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/session_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/__init__.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/__init__.py index 059c08c3db..f861b1e1f1 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py index 1a8512051b..5a333f43b7 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -208,7 +208,7 @@ def transport(self) -> SpecialistPoolServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -362,11 +362,11 @@ async def sample_create_specialist_pool(): ) # Make the request - operation = client.create_specialist_pool(request=request) + operation = await client.create_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -759,11 +759,11 @@ async def sample_delete_specialist_pool(): ) # Make the request - operation = client.delete_specialist_pool(request=request) + operation = await client.delete_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -900,11 +900,11 @@ async def sample_update_specialist_pool(): ) # Make the request - operation = client.update_specialist_pool(request=request) + operation = await client.update_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1012,7 +1012,7 @@ async def sample_update_specialist_pool(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1038,8 +1038,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1048,7 +1052,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1056,7 +1060,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1067,7 +1071,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1093,8 +1097,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1103,7 +1111,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1111,7 +1119,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1122,7 +1130,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1152,8 +1160,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1162,7 +1174,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1170,7 +1182,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1178,7 +1190,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1207,8 +1219,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1217,7 +1233,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1225,7 +1241,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1233,7 +1249,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1265,8 +1281,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1275,7 +1295,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1283,7 +1303,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1294,7 +1314,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1386,8 +1406,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1396,7 +1420,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1404,7 +1430,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1415,7 +1441,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1508,8 +1534,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1518,7 +1548,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1526,7 +1558,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1537,7 +1569,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1568,8 +1600,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1580,7 +1616,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1588,7 +1626,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1599,7 +1637,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1625,8 +1663,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1635,7 +1677,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1643,7 +1685,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1696,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1680,8 +1722,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1690,7 +1736,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1698,7 +1744,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py index 1a6f5e7585..bcf0448d23 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ from .transports.grpc_asyncio import SpecialistPoolServiceGrpcAsyncIOTransport from .transports.rest import SpecialistPoolServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncSpecialistPoolServiceRestTransport @@ -141,7 +142,7 @@ class SpecialistPoolServiceClient(metaclass=SpecialistPoolServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -466,7 +471,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -565,7 +570,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -665,7 +670,7 @@ def __init__( self._universe_domain = SpecialistPoolServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1480,7 +1485,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1506,8 +1511,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1516,7 +1525,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1525,7 +1534,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1539,7 +1548,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1565,8 +1574,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1575,7 +1588,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1584,7 +1597,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1598,7 +1611,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1628,8 +1641,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1638,7 +1655,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1646,7 +1663,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1671,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1683,8 +1700,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1693,7 +1714,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1701,7 +1722,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1709,7 +1730,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1741,8 +1762,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1751,7 +1776,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1760,7 +1785,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1774,7 +1799,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1866,8 +1891,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1876,7 +1905,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1885,7 +1916,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1899,7 +1930,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1992,8 +2023,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2002,7 +2037,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2011,7 +2048,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2025,7 +2062,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2056,8 +2093,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2066,7 +2107,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2075,7 +2118,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2089,7 +2132,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2115,8 +2158,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2125,7 +2172,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2134,7 +2181,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2148,7 +2195,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2174,8 +2221,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2184,7 +2235,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2193,7 +2244,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py index caffba7d4d..6bf2e07dfd 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/README.rst b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/README.rst index 5e31a11c15..9d985be883 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`SpecialistPoolServiceTransport` is the ABC for all transports. -- public child `SpecialistPoolServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `SpecialistPoolServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseSpecialistPoolServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `SpecialistPoolServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``SpecialistPoolServiceTransport`` is the ABC for all transports. + +- public child ``SpecialistPoolServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``SpecialistPoolServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseSpecialistPoolServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``SpecialistPoolServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/__init__.py index 5aadf157f9..052851c414 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/base.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/base.py index 4d55620222..11dfff5303 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py index 1cff0cb3d9..6b9ba4ee10 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py index ca3acae35f..490d53e6b8 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py index 77b46bc12b..78fdbe4d49 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[SpecialistPoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py index faa8579910..f53f852f68 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -694,6 +694,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncSpecialistPoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_base.py index 8f43b9a26f..c8f39716d2 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/__init__.py b/google/cloud/aiplatform_v1/services/tensorboard_service/__init__.py index b7458d641e..cc6fccd0b6 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py b/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py index 5d6b6ca8e9..95b555e87d 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -229,7 +229,7 @@ def transport(self) -> TensorboardServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -382,11 +382,11 @@ async def sample_create_tensorboard(): ) # Make the request - operation = client.create_tensorboard(request=request) + operation = await client.create_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -640,11 +640,11 @@ async def sample_update_tensorboard(): ) # Make the request - operation = client.update_tensorboard(request=request) + operation = await client.update_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -915,11 +915,11 @@ async def sample_delete_tensorboard(): ) # Make the request - operation = client.delete_tensorboard(request=request) + operation = await client.delete_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1810,11 +1810,11 @@ async def sample_delete_tensorboard_experiment(): ) # Make the request - operation = client.delete_tensorboard_experiment(request=request) + operation = await client.delete_tensorboard_experiment(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2613,11 +2613,11 @@ async def sample_delete_tensorboard_run(): ) # Make the request - operation = client.delete_tensorboard_run(request=request) + operation = await client.delete_tensorboard_run(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3415,11 +3415,11 @@ async def sample_delete_tensorboard_time_series(): ) # Make the request - operation = client.delete_tensorboard_time_series(request=request) + operation = await client.delete_tensorboard_time_series(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4308,7 +4308,7 @@ async def sample_export_tensorboard_time_series_data(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4334,8 +4334,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4344,7 +4348,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4352,7 +4356,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4363,7 +4367,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4389,8 +4393,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4399,7 +4407,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4407,7 +4415,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4418,7 +4426,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4448,8 +4456,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4458,7 +4470,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4466,7 +4478,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4474,7 +4486,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4503,8 +4515,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4513,7 +4529,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4521,7 +4537,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4529,7 +4545,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4561,8 +4577,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4571,7 +4591,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4579,7 +4599,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4590,7 +4610,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4682,8 +4702,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4692,7 +4716,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4700,7 +4726,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4711,7 +4737,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4804,8 +4830,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4814,7 +4844,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4822,7 +4854,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4833,7 +4865,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4864,8 +4896,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4876,7 +4912,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4884,7 +4922,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4895,7 +4933,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4921,8 +4959,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4931,7 +4973,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4939,7 +4981,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4950,7 +4992,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4976,8 +5018,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4986,7 +5032,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4994,7 +5040,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/client.py b/google/cloud/aiplatform_v1/services/tensorboard_service/client.py index d492ebd0c5..69d1c9cd10 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/client.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,7 @@ from .transports.grpc_asyncio import TensorboardServiceGrpcAsyncIOTransport from .transports.rest import TensorboardServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncTensorboardServiceRestTransport @@ -149,7 +150,7 @@ class TensorboardServiceClient(metaclass=TensorboardServiceClientMeta): """TensorboardService""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -157,7 +158,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -167,6 +168,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -554,7 +559,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -651,7 +656,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -751,7 +756,7 @@ def __init__( self._universe_domain = TensorboardServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -4802,7 +4807,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4828,8 +4833,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4838,7 +4847,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4847,7 +4856,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4861,7 +4870,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4887,8 +4896,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4897,7 +4910,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4906,7 +4919,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4920,7 +4933,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4950,8 +4963,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4960,7 +4977,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4968,7 +4985,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4976,7 +4993,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5005,8 +5022,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5015,7 +5036,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5023,7 +5044,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5031,7 +5052,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5063,8 +5084,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5073,7 +5098,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5082,7 +5107,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5096,7 +5121,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5188,8 +5213,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5198,7 +5227,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5207,7 +5238,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5221,7 +5252,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5314,8 +5345,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5324,7 +5359,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5333,7 +5370,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5347,7 +5384,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5378,8 +5415,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5388,7 +5429,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5397,7 +5440,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5411,7 +5454,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5437,8 +5480,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5447,7 +5494,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5456,7 +5503,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5470,7 +5517,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5496,8 +5543,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5506,7 +5557,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5515,7 +5566,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py b/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py index b7d18059c3..bafe624d1a 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/README.rst b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/README.rst index c72df371f0..70822fce1f 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`TensorboardServiceTransport` is the ABC for all transports. -- public child `TensorboardServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `TensorboardServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseTensorboardServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `TensorboardServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``TensorboardServiceTransport`` is the ABC for all transports. + +- public child ``TensorboardServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``TensorboardServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseTensorboardServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``TensorboardServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/__init__.py index fe4d73f7f5..a4f4888bf0 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/base.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/base.py index 0454a91bbb..00d0c30e9a 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -100,6 +100,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -149,6 +153,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py index d4812515fc..e7d7800284 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -201,6 +201,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py index 500a6f2d26..d9f0e5b80a 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -112,7 +112,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -252,6 +252,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py index 7b9382d913..2856e71ce6 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2183,6 +2183,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[TensorboardServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py index 2d85c8f014..13f004d8e5 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2185,6 +2185,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncTensorboardServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_base.py index bf5a34a2f4..df046c1782 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/__init__.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/__init__.py index cca9bafda3..ec0458d040 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py index 92681232f1..4f01641c66 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -216,7 +216,7 @@ def transport(self) -> VertexRagDataServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -369,11 +369,11 @@ async def sample_create_rag_corpus(): ) # Make the request - operation = client.create_rag_corpus(request=request) + operation = await client.create_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -507,11 +507,11 @@ async def sample_update_rag_corpus(): ) # Make the request - operation = client.update_rag_corpus(request=request) + operation = await client.update_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -879,11 +879,11 @@ async def sample_delete_rag_corpus(): ) # Make the request - operation = client.delete_rag_corpus(request=request) + operation = await client.delete_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1161,11 +1161,11 @@ async def sample_import_rag_files(): ) # Make the request - operation = client.import_rag_files(request=request) + operation = await client.import_rag_files(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1541,11 +1541,11 @@ async def sample_delete_rag_file(): ) # Make the request - operation = client.delete_rag_file(request=request) + operation = await client.delete_rag_file(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1676,11 +1676,11 @@ async def sample_update_rag_engine_config(): ) # Make the request - operation = client.update_rag_engine_config(request=request) + operation = await client.update_rag_engine_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1892,7 +1892,7 @@ async def sample_get_rag_engine_config(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1918,8 +1918,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1928,7 +1932,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1936,7 +1940,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1947,7 +1951,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1973,8 +1977,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1983,7 +1991,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1991,7 +1999,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2002,7 +2010,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2032,8 +2040,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2042,7 +2054,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2050,7 +2062,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2058,7 +2070,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2087,8 +2099,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2097,7 +2113,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2105,7 +2121,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2113,7 +2129,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2145,8 +2161,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2155,7 +2175,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2163,7 +2183,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2174,7 +2194,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2266,8 +2286,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2276,7 +2300,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2284,7 +2310,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2295,7 +2321,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2388,8 +2414,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2398,7 +2428,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2406,7 +2438,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2417,7 +2449,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2448,8 +2480,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2460,7 +2496,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2468,7 +2506,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2479,7 +2517,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2505,8 +2543,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2515,7 +2557,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2523,7 +2565,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2534,7 +2576,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2560,8 +2602,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2570,7 +2616,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2578,7 +2624,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py index d5b30bb8b5..a3998d1ef2 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,6 +81,7 @@ from .transports.grpc_asyncio import VertexRagDataServiceGrpcAsyncIOTransport from .transports.rest import VertexRagDataServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVertexRagDataServiceRestTransport @@ -137,7 +138,7 @@ class VertexRagDataServiceClient(metaclass=VertexRagDataServiceClientMeta): """A service for managing user data for RAG.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -145,7 +146,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -155,6 +156,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -572,7 +577,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -669,7 +674,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -769,7 +774,7 @@ def __init__( self._universe_domain = VertexRagDataServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2435,7 +2440,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2461,8 +2466,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2471,7 +2480,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2480,7 +2489,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2494,7 +2503,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2520,8 +2529,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2530,7 +2543,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2539,7 +2552,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2553,7 +2566,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2583,8 +2596,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2593,7 +2610,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2601,7 +2618,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2609,7 +2626,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2638,8 +2655,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2648,7 +2669,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2656,7 +2677,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2664,7 +2685,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2696,8 +2717,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2706,7 +2731,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2715,7 +2740,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2729,7 +2754,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2821,8 +2846,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2831,7 +2860,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2840,7 +2871,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2854,7 +2885,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2947,8 +2978,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2957,7 +2992,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2966,7 +3003,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2980,7 +3017,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3011,8 +3048,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3021,7 +3062,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3030,7 +3073,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3044,7 +3087,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3070,8 +3113,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3080,7 +3127,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3089,7 +3136,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3103,7 +3150,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3129,8 +3176,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3139,7 +3190,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3148,7 +3199,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py index a66d8330b9..99161e6a6f 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/README.rst b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/README.rst index b32f03f312..3509f5a817 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VertexRagDataServiceTransport` is the ABC for all transports. -- public child `VertexRagDataServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VertexRagDataServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVertexRagDataServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VertexRagDataServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VertexRagDataServiceTransport`` is the ABC for all transports. + +- public child ``VertexRagDataServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VertexRagDataServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVertexRagDataServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VertexRagDataServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/__init__.py index b0f0007ee7..241a9623a2 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/base.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/base.py index e4eee4a8ee..9de1fccccb 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py index 6f96913151..e02e630bdd 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py index a57bae8751..cfbf7407b4 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py index f3ed86ebae..4fceab431f 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1095,6 +1095,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VertexRagDataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py index 0e7fb54bda..c2207a08b3 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1096,6 +1096,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVertexRagDataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_base.py index 983fb0f255..ab37fc8817 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/__init__.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/__init__.py index 4daee04571..ea16b8c279 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py index 7b8c63f181..00ecab8223 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -193,7 +193,7 @@ def transport(self) -> VertexRagServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -869,11 +869,11 @@ async def sample_async_retrieve_contexts(): ) # Make the request - operation = client.async_retrieve_contexts(request=request) + operation = await client.async_retrieve_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -973,7 +973,7 @@ async def sample_async_retrieve_contexts(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -999,8 +999,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1009,7 +1013,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1017,7 +1021,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1028,7 +1032,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1054,8 +1058,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1064,7 +1072,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1072,7 +1080,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1083,7 +1091,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1113,8 +1121,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1123,7 +1135,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1131,7 +1143,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1139,7 +1151,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1168,8 +1180,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1178,7 +1194,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1186,7 +1202,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1194,7 +1210,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1226,8 +1242,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1236,7 +1256,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1244,7 +1264,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1255,7 +1275,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1347,8 +1367,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1357,7 +1381,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1365,7 +1391,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1376,7 +1402,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1469,8 +1495,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1479,7 +1509,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1487,7 +1519,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1498,7 +1530,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1529,8 +1561,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1541,7 +1577,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1549,7 +1587,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1560,7 +1598,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1586,8 +1624,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1596,7 +1638,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1604,7 +1646,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1615,7 +1657,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1641,8 +1683,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1651,7 +1697,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1659,7 +1705,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py index cecbce4c24..aa962f0d0b 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ from .transports.grpc_asyncio import VertexRagServiceGrpcAsyncIOTransport from .transports.rest import VertexRagServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVertexRagServiceRestTransport @@ -132,7 +133,7 @@ class VertexRagServiceClient(metaclass=VertexRagServiceClientMeta): """A service for retrieving relevant contexts.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -140,7 +141,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -150,6 +151,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -457,7 +462,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -554,7 +559,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -652,7 +657,7 @@ def __init__( self._universe_domain = VertexRagServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1445,7 +1450,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1471,8 +1476,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1481,7 +1490,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1490,7 +1499,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1504,7 +1513,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1530,8 +1539,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1540,7 +1553,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1549,7 +1562,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1563,7 +1576,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1593,8 +1606,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1603,7 +1620,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1611,7 +1628,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1619,7 +1636,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1648,8 +1665,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1658,7 +1679,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1666,7 +1687,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1674,7 +1695,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1706,8 +1727,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1716,7 +1741,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1725,7 +1750,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1739,7 +1764,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1831,8 +1856,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1841,7 +1870,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1850,7 +1881,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1864,7 +1895,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1957,8 +1988,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1967,7 +2002,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1976,7 +2013,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1990,7 +2027,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2021,8 +2058,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2031,7 +2072,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2040,7 +2083,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2054,7 +2097,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2080,8 +2123,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2090,7 +2137,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2099,7 +2146,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2113,7 +2160,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2139,8 +2186,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2149,7 +2200,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2158,7 +2209,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/README.rst b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/README.rst index fd123be16c..fc1d9c6918 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VertexRagServiceTransport` is the ABC for all transports. -- public child `VertexRagServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VertexRagServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVertexRagServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VertexRagServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VertexRagServiceTransport`` is the ABC for all transports. + +- public child ``VertexRagServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VertexRagServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVertexRagServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VertexRagServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/__init__.py index 11c659e82f..380be92ca6 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/base.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/base.py index 4c128fbdc1..4f25f81330 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py index 07cdbe5054..c1a2e5dc98 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py index 0a095b8de1..76d1e9a023 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py index b66fc4e88d..b31bdd2d06 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VertexRagServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py index bce3b637a6..c3805e5a77 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -694,6 +694,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVertexRagServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_base.py index ecfc55b3b0..4c834c5bfb 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/__init__.py b/google/cloud/aiplatform_v1/services/vizier_service/__init__.py index 85fe3cba26..fe359b0e97 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/__init__.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/async_client.py b/google/cloud/aiplatform_v1/services/vizier_service/async_client.py index ccbbcdca32..62678abbe5 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -203,7 +203,7 @@ def transport(self) -> VizierServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -929,11 +929,11 @@ async def sample_suggest_trials(): ) # Make the request - operation = client.suggest_trials(request=request) + operation = await client.suggest_trials(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1681,11 +1681,11 @@ async def sample_check_trial_early_stopping_state(): ) # Make the request - operation = client.check_trial_early_stopping_state(request=request) + operation = await client.check_trial_early_stopping_state(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1957,7 +1957,7 @@ async def sample_list_optimal_trials(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1983,8 +1983,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1993,7 +1997,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2001,7 +2005,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2012,7 +2016,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2038,8 +2042,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2048,7 +2056,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2056,7 +2064,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2067,7 +2075,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2097,8 +2105,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2107,7 +2119,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2115,7 +2127,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2123,7 +2135,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2152,8 +2164,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2162,7 +2178,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2170,7 +2186,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2178,7 +2194,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2210,8 +2226,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2220,7 +2240,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2228,7 +2248,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2239,7 +2259,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2331,8 +2351,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2341,7 +2365,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2349,7 +2375,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2360,7 +2386,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2453,8 +2479,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2463,7 +2493,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2471,7 +2503,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2482,7 +2514,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2513,8 +2545,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2525,7 +2561,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2533,7 +2571,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2544,7 +2582,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2570,8 +2608,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2580,7 +2622,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2588,7 +2630,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2599,7 +2641,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2625,8 +2667,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2635,7 +2681,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2643,7 +2689,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vizier_service/client.py b/google/cloud/aiplatform_v1/services/vizier_service/client.py index 8fbd0780a5..41c87b0262 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/client.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ from .transports.grpc_asyncio import VizierServiceGrpcAsyncIOTransport from .transports.rest import VizierServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVizierServiceRestTransport @@ -136,7 +137,7 @@ class VizierServiceClient(metaclass=VizierServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -507,7 +512,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -604,7 +609,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -700,7 +705,7 @@ def __init__( self._universe_domain = VizierServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2445,7 +2450,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2471,8 +2476,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2481,7 +2490,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2490,7 +2499,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2504,7 +2513,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2530,8 +2539,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2540,7 +2553,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2549,7 +2562,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2563,7 +2576,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2593,8 +2606,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2603,7 +2620,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2611,7 +2628,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2619,7 +2636,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2648,8 +2665,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2658,7 +2679,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2666,7 +2687,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2674,7 +2695,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2706,8 +2727,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2716,7 +2741,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2725,7 +2750,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2739,7 +2764,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2831,8 +2856,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2841,7 +2870,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2850,7 +2881,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2864,7 +2895,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2957,8 +2988,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2967,7 +3002,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2976,7 +3013,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2990,7 +3027,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3021,8 +3058,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3031,7 +3072,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3040,7 +3083,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3054,7 +3097,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3080,8 +3123,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3090,7 +3137,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3099,7 +3146,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3113,7 +3160,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3139,8 +3186,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3149,7 +3200,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3158,7 +3209,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1/services/vizier_service/pagers.py b/google/cloud/aiplatform_v1/services/vizier_service/pagers.py index 3ee0b51ab3..a31ea8a51c 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/README.rst b/google/cloud/aiplatform_v1/services/vizier_service/transports/README.rst index 2761e34629..614e1fd8b3 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/README.rst +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VizierServiceTransport` is the ABC for all transports. -- public child `VizierServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VizierServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVizierServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VizierServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VizierServiceTransport`` is the ABC for all transports. + +- public child ``VizierServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VizierServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVizierServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VizierServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/__init__.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/__init__.py index 6428db1e28..a7bbdd9840 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/base.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/base.py index 73c991c508..481aa848c4 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/base.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py index 140b876c90..e316bd32ab 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -197,6 +197,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py index 110d7f34fb..63a4af2482 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -248,6 +248,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py index ba2ec3248a..00a834b8ca 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1145,6 +1145,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VizierServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py index 3d3a76bc74..3a4b2755d5 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1146,6 +1146,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVizierServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_base.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_base.py index 71c0832a58..988b5466f3 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/__init__.py b/google/cloud/aiplatform_v1/types/__init__.py index 4edbfef98b..9a0304e168 100644 --- a/google/cloud/aiplatform_v1/types/__init__.py +++ b/google/cloud/aiplatform_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -971,6 +971,8 @@ AsyncQueryReasoningEngineOperationMetadata, AsyncQueryReasoningEngineRequest, AsyncQueryReasoningEngineResponse, + CancelAsyncQueryReasoningEngineRequest, + CancelAsyncQueryReasoningEngineResponse, QueryReasoningEngineRequest, QueryReasoningEngineResponse, StreamQueryReasoningEngineRequest, @@ -2038,6 +2040,8 @@ "AsyncQueryReasoningEngineOperationMetadata", "AsyncQueryReasoningEngineRequest", "AsyncQueryReasoningEngineResponse", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", "QueryReasoningEngineRequest", "QueryReasoningEngineResponse", "StreamQueryReasoningEngineRequest", diff --git a/google/cloud/aiplatform_v1/types/accelerator_type.py b/google/cloud/aiplatform_v1/types/accelerator_type.py index 44c8fb5cb4..bfde4d488f 100644 --- a/google/cloud/aiplatform_v1/types/accelerator_type.py +++ b/google/cloud/aiplatform_v1/types/accelerator_type.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/annotation.py b/google/cloud/aiplatform_v1/types/annotation.py index 8bc946506d..2a87352d55 100644 --- a/google/cloud/aiplatform_v1/types/annotation.py +++ b/google/cloud/aiplatform_v1/types/annotation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/annotation_spec.py b/google/cloud/aiplatform_v1/types/annotation_spec.py index a9cc4c6434..9c1c074e53 100644 --- a/google/cloud/aiplatform_v1/types/annotation_spec.py +++ b/google/cloud/aiplatform_v1/types/annotation_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/api_auth.py b/google/cloud/aiplatform_v1/types/api_auth.py index ab686691c1..6aeb65133a 100644 --- a/google/cloud/aiplatform_v1/types/api_auth.py +++ b/google/cloud/aiplatform_v1/types/api_auth.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/artifact.py b/google/cloud/aiplatform_v1/types/artifact.py index 8ef8c96c41..e99cbcd650 100644 --- a/google/cloud/aiplatform_v1/types/artifact.py +++ b/google/cloud/aiplatform_v1/types/artifact.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/batch_prediction_job.py b/google/cloud/aiplatform_v1/types/batch_prediction_job.py index 4914cd3cd8..ec66641d49 100644 --- a/google/cloud/aiplatform_v1/types/batch_prediction_job.py +++ b/google/cloud/aiplatform_v1/types/batch_prediction_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/cached_content.py b/google/cloud/aiplatform_v1/types/cached_content.py index 172b1f8807..f3234d396a 100644 --- a/google/cloud/aiplatform_v1/types/cached_content.py +++ b/google/cloud/aiplatform_v1/types/cached_content.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/completion_stats.py b/google/cloud/aiplatform_v1/types/completion_stats.py index c5637fef8b..3f60cab814 100644 --- a/google/cloud/aiplatform_v1/types/completion_stats.py +++ b/google/cloud/aiplatform_v1/types/completion_stats.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/content.py b/google/cloud/aiplatform_v1/types/content.py index 101c10147d..7526f526db 100644 --- a/google/cloud/aiplatform_v1/types/content.py +++ b/google/cloud/aiplatform_v1/types/content.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/context.py b/google/cloud/aiplatform_v1/types/context.py index 2565866942..490c85cfee 100644 --- a/google/cloud/aiplatform_v1/types/context.py +++ b/google/cloud/aiplatform_v1/types/context.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/custom_job.py b/google/cloud/aiplatform_v1/types/custom_job.py index ac4840216b..64329ce5bd 100644 --- a/google/cloud/aiplatform_v1/types/custom_job.py +++ b/google/cloud/aiplatform_v1/types/custom_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/data_foundry_service.py b/google/cloud/aiplatform_v1/types/data_foundry_service.py index 8d1c9bb36a..c219760886 100644 --- a/google/cloud/aiplatform_v1/types/data_foundry_service.py +++ b/google/cloud/aiplatform_v1/types/data_foundry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/data_item.py b/google/cloud/aiplatform_v1/types/data_item.py index 41dff36c0e..f3d4890552 100644 --- a/google/cloud/aiplatform_v1/types/data_item.py +++ b/google/cloud/aiplatform_v1/types/data_item.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/data_labeling_job.py b/google/cloud/aiplatform_v1/types/data_labeling_job.py index c65d5e03dd..8c0fd86e88 100644 --- a/google/cloud/aiplatform_v1/types/data_labeling_job.py +++ b/google/cloud/aiplatform_v1/types/data_labeling_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/dataset.py b/google/cloud/aiplatform_v1/types/dataset.py index 6545e56438..e8a753593f 100644 --- a/google/cloud/aiplatform_v1/types/dataset.py +++ b/google/cloud/aiplatform_v1/types/dataset.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/dataset_service.py b/google/cloud/aiplatform_v1/types/dataset_service.py index 6c490b5049..8bdcc2c66a 100644 --- a/google/cloud/aiplatform_v1/types/dataset_service.py +++ b/google/cloud/aiplatform_v1/types/dataset_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/dataset_version.py b/google/cloud/aiplatform_v1/types/dataset_version.py index 771bc1714d..c4db5ed86a 100644 --- a/google/cloud/aiplatform_v1/types/dataset_version.py +++ b/google/cloud/aiplatform_v1/types/dataset_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/deployed_index_ref.py b/google/cloud/aiplatform_v1/types/deployed_index_ref.py index 3eec67d775..ae375ed1fe 100644 --- a/google/cloud/aiplatform_v1/types/deployed_index_ref.py +++ b/google/cloud/aiplatform_v1/types/deployed_index_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/deployed_model_ref.py b/google/cloud/aiplatform_v1/types/deployed_model_ref.py index 11855dc98e..b2e7c8b449 100644 --- a/google/cloud/aiplatform_v1/types/deployed_model_ref.py +++ b/google/cloud/aiplatform_v1/types/deployed_model_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/deployment_resource_pool.py b/google/cloud/aiplatform_v1/types/deployment_resource_pool.py index be316e5c06..29f80d1749 100644 --- a/google/cloud/aiplatform_v1/types/deployment_resource_pool.py +++ b/google/cloud/aiplatform_v1/types/deployment_resource_pool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/deployment_resource_pool_service.py b/google/cloud/aiplatform_v1/types/deployment_resource_pool_service.py index 689b3265ae..780ecf5fb9 100644 --- a/google/cloud/aiplatform_v1/types/deployment_resource_pool_service.py +++ b/google/cloud/aiplatform_v1/types/deployment_resource_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/deployment_stage.py b/google/cloud/aiplatform_v1/types/deployment_stage.py index 33ebadc7c9..03df16db65 100644 --- a/google/cloud/aiplatform_v1/types/deployment_stage.py +++ b/google/cloud/aiplatform_v1/types/deployment_stage.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/encryption_spec.py b/google/cloud/aiplatform_v1/types/encryption_spec.py index d3e36bdf3d..21e72f8693 100644 --- a/google/cloud/aiplatform_v1/types/encryption_spec.py +++ b/google/cloud/aiplatform_v1/types/encryption_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/endpoint.py b/google/cloud/aiplatform_v1/types/endpoint.py index 51593479c9..e1db0eab46 100644 --- a/google/cloud/aiplatform_v1/types/endpoint.py +++ b/google/cloud/aiplatform_v1/types/endpoint.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/endpoint_service.py b/google/cloud/aiplatform_v1/types/endpoint_service.py index 06c6306e92..7a20ccf0ca 100644 --- a/google/cloud/aiplatform_v1/types/endpoint_service.py +++ b/google/cloud/aiplatform_v1/types/endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/entity_type.py b/google/cloud/aiplatform_v1/types/entity_type.py index 75fb6a684a..de20e9c7ab 100644 --- a/google/cloud/aiplatform_v1/types/entity_type.py +++ b/google/cloud/aiplatform_v1/types/entity_type.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/env_var.py b/google/cloud/aiplatform_v1/types/env_var.py index 9e34bca7c5..0d9472e063 100644 --- a/google/cloud/aiplatform_v1/types/env_var.py +++ b/google/cloud/aiplatform_v1/types/env_var.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/evaluated_annotation.py b/google/cloud/aiplatform_v1/types/evaluated_annotation.py index b621c4b806..6168c506ff 100644 --- a/google/cloud/aiplatform_v1/types/evaluated_annotation.py +++ b/google/cloud/aiplatform_v1/types/evaluated_annotation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/evaluation_service.py b/google/cloud/aiplatform_v1/types/evaluation_service.py index 9ba05390ac..85fa911b99 100644 --- a/google/cloud/aiplatform_v1/types/evaluation_service.py +++ b/google/cloud/aiplatform_v1/types/evaluation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/event.py b/google/cloud/aiplatform_v1/types/event.py index e3b4c350d2..c513f257f3 100644 --- a/google/cloud/aiplatform_v1/types/event.py +++ b/google/cloud/aiplatform_v1/types/event.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/execution.py b/google/cloud/aiplatform_v1/types/execution.py index 2b70eeba02..a05a6e09d1 100644 --- a/google/cloud/aiplatform_v1/types/execution.py +++ b/google/cloud/aiplatform_v1/types/execution.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/explanation.py b/google/cloud/aiplatform_v1/types/explanation.py index 3d0e509734..6a405630d3 100644 --- a/google/cloud/aiplatform_v1/types/explanation.py +++ b/google/cloud/aiplatform_v1/types/explanation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/explanation_metadata.py b/google/cloud/aiplatform_v1/types/explanation_metadata.py index a903a48841..f347bd446f 100644 --- a/google/cloud/aiplatform_v1/types/explanation_metadata.py +++ b/google/cloud/aiplatform_v1/types/explanation_metadata.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature.py b/google/cloud/aiplatform_v1/types/feature.py index 0bd1c4dece..ff72a3203f 100644 --- a/google/cloud/aiplatform_v1/types/feature.py +++ b/google/cloud/aiplatform_v1/types/feature.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_group.py b/google/cloud/aiplatform_v1/types/feature_group.py index e85b0f8afd..d886d99bf2 100644 --- a/google/cloud/aiplatform_v1/types/feature_group.py +++ b/google/cloud/aiplatform_v1/types/feature_group.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_monitoring_stats.py b/google/cloud/aiplatform_v1/types/feature_monitoring_stats.py index d7ef8832c5..0154e20019 100644 --- a/google/cloud/aiplatform_v1/types/feature_monitoring_stats.py +++ b/google/cloud/aiplatform_v1/types/feature_monitoring_stats.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_online_store.py b/google/cloud/aiplatform_v1/types/feature_online_store.py index 4a7face2a6..21e2f007e6 100644 --- a/google/cloud/aiplatform_v1/types/feature_online_store.py +++ b/google/cloud/aiplatform_v1/types/feature_online_store.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_online_store_admin_service.py b/google/cloud/aiplatform_v1/types/feature_online_store_admin_service.py index bb8692d36b..2f796b69fe 100644 --- a/google/cloud/aiplatform_v1/types/feature_online_store_admin_service.py +++ b/google/cloud/aiplatform_v1/types/feature_online_store_admin_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_online_store_service.py b/google/cloud/aiplatform_v1/types/feature_online_store_service.py index 65b7491e4e..38490d1246 100644 --- a/google/cloud/aiplatform_v1/types/feature_online_store_service.py +++ b/google/cloud/aiplatform_v1/types/feature_online_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_registry_service.py b/google/cloud/aiplatform_v1/types/feature_registry_service.py index ad133bd881..a32c3bafb7 100644 --- a/google/cloud/aiplatform_v1/types/feature_registry_service.py +++ b/google/cloud/aiplatform_v1/types/feature_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_selector.py b/google/cloud/aiplatform_v1/types/feature_selector.py index 5150e1148d..bf31dd851d 100644 --- a/google/cloud/aiplatform_v1/types/feature_selector.py +++ b/google/cloud/aiplatform_v1/types/feature_selector.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_view.py b/google/cloud/aiplatform_v1/types/feature_view.py index 20a6c2cf0d..2db45de949 100644 --- a/google/cloud/aiplatform_v1/types/feature_view.py +++ b/google/cloud/aiplatform_v1/types/feature_view.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/feature_view_sync.py b/google/cloud/aiplatform_v1/types/feature_view_sync.py index b299a87425..6188b23761 100644 --- a/google/cloud/aiplatform_v1/types/feature_view_sync.py +++ b/google/cloud/aiplatform_v1/types/feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/featurestore.py b/google/cloud/aiplatform_v1/types/featurestore.py index e7313c4a95..e36c9e1e17 100644 --- a/google/cloud/aiplatform_v1/types/featurestore.py +++ b/google/cloud/aiplatform_v1/types/featurestore.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/featurestore_monitoring.py b/google/cloud/aiplatform_v1/types/featurestore_monitoring.py index 5800e8631b..87bada6d95 100644 --- a/google/cloud/aiplatform_v1/types/featurestore_monitoring.py +++ b/google/cloud/aiplatform_v1/types/featurestore_monitoring.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/featurestore_online_service.py b/google/cloud/aiplatform_v1/types/featurestore_online_service.py index 94e6eb9484..5d19bff326 100644 --- a/google/cloud/aiplatform_v1/types/featurestore_online_service.py +++ b/google/cloud/aiplatform_v1/types/featurestore_online_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/featurestore_service.py b/google/cloud/aiplatform_v1/types/featurestore_service.py index 6bcf06d1e1..132e429803 100644 --- a/google/cloud/aiplatform_v1/types/featurestore_service.py +++ b/google/cloud/aiplatform_v1/types/featurestore_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/gen_ai_cache_service.py b/google/cloud/aiplatform_v1/types/gen_ai_cache_service.py index 68e9f42de6..a687c2aae1 100644 --- a/google/cloud/aiplatform_v1/types/gen_ai_cache_service.py +++ b/google/cloud/aiplatform_v1/types/gen_ai_cache_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/genai_tuning_service.py b/google/cloud/aiplatform_v1/types/genai_tuning_service.py index 8effbd5420..9ae8e770fc 100644 --- a/google/cloud/aiplatform_v1/types/genai_tuning_service.py +++ b/google/cloud/aiplatform_v1/types/genai_tuning_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/hyperparameter_tuning_job.py b/google/cloud/aiplatform_v1/types/hyperparameter_tuning_job.py index a3f75710c7..ad53de96dc 100644 --- a/google/cloud/aiplatform_v1/types/hyperparameter_tuning_job.py +++ b/google/cloud/aiplatform_v1/types/hyperparameter_tuning_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/index.py b/google/cloud/aiplatform_v1/types/index.py index 162e64b501..170c8c8ace 100644 --- a/google/cloud/aiplatform_v1/types/index.py +++ b/google/cloud/aiplatform_v1/types/index.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/index_endpoint.py b/google/cloud/aiplatform_v1/types/index_endpoint.py index 27b892bea5..d39eec2719 100644 --- a/google/cloud/aiplatform_v1/types/index_endpoint.py +++ b/google/cloud/aiplatform_v1/types/index_endpoint.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/index_endpoint_service.py b/google/cloud/aiplatform_v1/types/index_endpoint_service.py index 305868f3b1..412a5c4b7c 100644 --- a/google/cloud/aiplatform_v1/types/index_endpoint_service.py +++ b/google/cloud/aiplatform_v1/types/index_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/index_service.py b/google/cloud/aiplatform_v1/types/index_service.py index 363850bd87..13f0e44d9d 100644 --- a/google/cloud/aiplatform_v1/types/index_service.py +++ b/google/cloud/aiplatform_v1/types/index_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/io.py b/google/cloud/aiplatform_v1/types/io.py index ac11ade652..726e1b2cd3 100644 --- a/google/cloud/aiplatform_v1/types/io.py +++ b/google/cloud/aiplatform_v1/types/io.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/job_service.py b/google/cloud/aiplatform_v1/types/job_service.py index c4fa5aca2a..f41b331201 100644 --- a/google/cloud/aiplatform_v1/types/job_service.py +++ b/google/cloud/aiplatform_v1/types/job_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/job_state.py b/google/cloud/aiplatform_v1/types/job_state.py index ea784a89fd..1ae5d55cde 100644 --- a/google/cloud/aiplatform_v1/types/job_state.py +++ b/google/cloud/aiplatform_v1/types/job_state.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/lineage_subgraph.py b/google/cloud/aiplatform_v1/types/lineage_subgraph.py index 920918c8f1..f3abbfe918 100644 --- a/google/cloud/aiplatform_v1/types/lineage_subgraph.py +++ b/google/cloud/aiplatform_v1/types/lineage_subgraph.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/llm_utility_service.py b/google/cloud/aiplatform_v1/types/llm_utility_service.py index a959b86270..8ae7eba0a6 100644 --- a/google/cloud/aiplatform_v1/types/llm_utility_service.py +++ b/google/cloud/aiplatform_v1/types/llm_utility_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/machine_resources.py b/google/cloud/aiplatform_v1/types/machine_resources.py index de5671cff3..aea5716f6d 100644 --- a/google/cloud/aiplatform_v1/types/machine_resources.py +++ b/google/cloud/aiplatform_v1/types/machine_resources.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/manual_batch_tuning_parameters.py b/google/cloud/aiplatform_v1/types/manual_batch_tuning_parameters.py index 1599af9ec9..289e0b5cd4 100644 --- a/google/cloud/aiplatform_v1/types/manual_batch_tuning_parameters.py +++ b/google/cloud/aiplatform_v1/types/manual_batch_tuning_parameters.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/match_service.py b/google/cloud/aiplatform_v1/types/match_service.py index 0247f6f142..fd7bf8ff7b 100644 --- a/google/cloud/aiplatform_v1/types/match_service.py +++ b/google/cloud/aiplatform_v1/types/match_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/metadata_schema.py b/google/cloud/aiplatform_v1/types/metadata_schema.py index 92f58013b2..8382c933e8 100644 --- a/google/cloud/aiplatform_v1/types/metadata_schema.py +++ b/google/cloud/aiplatform_v1/types/metadata_schema.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/metadata_service.py b/google/cloud/aiplatform_v1/types/metadata_service.py index 9a46a6307f..e332712592 100644 --- a/google/cloud/aiplatform_v1/types/metadata_service.py +++ b/google/cloud/aiplatform_v1/types/metadata_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/metadata_store.py b/google/cloud/aiplatform_v1/types/metadata_store.py index 270712a984..42ec2ff7be 100644 --- a/google/cloud/aiplatform_v1/types/metadata_store.py +++ b/google/cloud/aiplatform_v1/types/metadata_store.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/migratable_resource.py b/google/cloud/aiplatform_v1/types/migratable_resource.py index cfbdc67237..f7aed43370 100644 --- a/google/cloud/aiplatform_v1/types/migratable_resource.py +++ b/google/cloud/aiplatform_v1/types/migratable_resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/migration_service.py b/google/cloud/aiplatform_v1/types/migration_service.py index 0a5a9182fc..80c644bd49 100644 --- a/google/cloud/aiplatform_v1/types/migration_service.py +++ b/google/cloud/aiplatform_v1/types/migration_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model.py b/google/cloud/aiplatform_v1/types/model.py index 80453ee31d..aa709c64d8 100644 --- a/google/cloud/aiplatform_v1/types/model.py +++ b/google/cloud/aiplatform_v1/types/model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_deployment_monitoring_job.py b/google/cloud/aiplatform_v1/types/model_deployment_monitoring_job.py index 3b84bfbcd0..5d917eee57 100644 --- a/google/cloud/aiplatform_v1/types/model_deployment_monitoring_job.py +++ b/google/cloud/aiplatform_v1/types/model_deployment_monitoring_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_evaluation.py b/google/cloud/aiplatform_v1/types/model_evaluation.py index a7c7d49738..fbcbdac53a 100644 --- a/google/cloud/aiplatform_v1/types/model_evaluation.py +++ b/google/cloud/aiplatform_v1/types/model_evaluation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_evaluation_slice.py b/google/cloud/aiplatform_v1/types/model_evaluation_slice.py index 98cbcda3ba..c95bea67b8 100644 --- a/google/cloud/aiplatform_v1/types/model_evaluation_slice.py +++ b/google/cloud/aiplatform_v1/types/model_evaluation_slice.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_garden_service.py b/google/cloud/aiplatform_v1/types/model_garden_service.py index 2e50eed228..15bf314996 100644 --- a/google/cloud/aiplatform_v1/types/model_garden_service.py +++ b/google/cloud/aiplatform_v1/types/model_garden_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_monitoring.py b/google/cloud/aiplatform_v1/types/model_monitoring.py index 8ded08af30..71736b7df8 100644 --- a/google/cloud/aiplatform_v1/types/model_monitoring.py +++ b/google/cloud/aiplatform_v1/types/model_monitoring.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/model_service.py b/google/cloud/aiplatform_v1/types/model_service.py index 3ecc76c8b5..ca29567dbd 100644 --- a/google/cloud/aiplatform_v1/types/model_service.py +++ b/google/cloud/aiplatform_v1/types/model_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/nas_job.py b/google/cloud/aiplatform_v1/types/nas_job.py index a52163a0ff..524c0bf982 100644 --- a/google/cloud/aiplatform_v1/types/nas_job.py +++ b/google/cloud/aiplatform_v1/types/nas_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/network_spec.py b/google/cloud/aiplatform_v1/types/network_spec.py index 48d7d78b62..7cf9b045cb 100644 --- a/google/cloud/aiplatform_v1/types/network_spec.py +++ b/google/cloud/aiplatform_v1/types/network_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_euc_config.py b/google/cloud/aiplatform_v1/types/notebook_euc_config.py index 4dc1b54b25..f3a1a624a4 100644 --- a/google/cloud/aiplatform_v1/types/notebook_euc_config.py +++ b/google/cloud/aiplatform_v1/types/notebook_euc_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_execution_job.py b/google/cloud/aiplatform_v1/types/notebook_execution_job.py index cd6ea579f9..657380ecbf 100644 --- a/google/cloud/aiplatform_v1/types/notebook_execution_job.py +++ b/google/cloud/aiplatform_v1/types/notebook_execution_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_idle_shutdown_config.py b/google/cloud/aiplatform_v1/types/notebook_idle_shutdown_config.py index 03e22e6bc7..b18f11c6a2 100644 --- a/google/cloud/aiplatform_v1/types/notebook_idle_shutdown_config.py +++ b/google/cloud/aiplatform_v1/types/notebook_idle_shutdown_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_runtime.py b/google/cloud/aiplatform_v1/types/notebook_runtime.py index d26993a462..ec9fd615b7 100644 --- a/google/cloud/aiplatform_v1/types/notebook_runtime.py +++ b/google/cloud/aiplatform_v1/types/notebook_runtime.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_runtime_template_ref.py b/google/cloud/aiplatform_v1/types/notebook_runtime_template_ref.py index d1f3e94f13..72d7e9a66d 100644 --- a/google/cloud/aiplatform_v1/types/notebook_runtime_template_ref.py +++ b/google/cloud/aiplatform_v1/types/notebook_runtime_template_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_service.py b/google/cloud/aiplatform_v1/types/notebook_service.py index 240967ca9d..3622400674 100644 --- a/google/cloud/aiplatform_v1/types/notebook_service.py +++ b/google/cloud/aiplatform_v1/types/notebook_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/notebook_software_config.py b/google/cloud/aiplatform_v1/types/notebook_software_config.py index 84d0f528e1..954b30c267 100644 --- a/google/cloud/aiplatform_v1/types/notebook_software_config.py +++ b/google/cloud/aiplatform_v1/types/notebook_software_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/openapi.py b/google/cloud/aiplatform_v1/types/openapi.py index c184c6fb02..27578c16c4 100644 --- a/google/cloud/aiplatform_v1/types/openapi.py +++ b/google/cloud/aiplatform_v1/types/openapi.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/operation.py b/google/cloud/aiplatform_v1/types/operation.py index f0c0cd9fb9..10188892d4 100644 --- a/google/cloud/aiplatform_v1/types/operation.py +++ b/google/cloud/aiplatform_v1/types/operation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/persistent_resource.py b/google/cloud/aiplatform_v1/types/persistent_resource.py index 350896324d..795914c358 100644 --- a/google/cloud/aiplatform_v1/types/persistent_resource.py +++ b/google/cloud/aiplatform_v1/types/persistent_resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/persistent_resource_service.py b/google/cloud/aiplatform_v1/types/persistent_resource_service.py index 56a48a2b77..6f05691d8c 100644 --- a/google/cloud/aiplatform_v1/types/persistent_resource_service.py +++ b/google/cloud/aiplatform_v1/types/persistent_resource_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/pipeline_failure_policy.py b/google/cloud/aiplatform_v1/types/pipeline_failure_policy.py index f87c4b0e27..22c234f08c 100644 --- a/google/cloud/aiplatform_v1/types/pipeline_failure_policy.py +++ b/google/cloud/aiplatform_v1/types/pipeline_failure_policy.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/pipeline_job.py b/google/cloud/aiplatform_v1/types/pipeline_job.py index 57101cb2af..131d690d2f 100644 --- a/google/cloud/aiplatform_v1/types/pipeline_job.py +++ b/google/cloud/aiplatform_v1/types/pipeline_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/pipeline_service.py b/google/cloud/aiplatform_v1/types/pipeline_service.py index 697af698bd..3507f60c0f 100644 --- a/google/cloud/aiplatform_v1/types/pipeline_service.py +++ b/google/cloud/aiplatform_v1/types/pipeline_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/pipeline_state.py b/google/cloud/aiplatform_v1/types/pipeline_state.py index bca4dc71d6..6b068e3646 100644 --- a/google/cloud/aiplatform_v1/types/pipeline_state.py +++ b/google/cloud/aiplatform_v1/types/pipeline_state.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/prediction_service.py b/google/cloud/aiplatform_v1/types/prediction_service.py index d93f931435..2318681aa2 100644 --- a/google/cloud/aiplatform_v1/types/prediction_service.py +++ b/google/cloud/aiplatform_v1/types/prediction_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/publisher_model.py b/google/cloud/aiplatform_v1/types/publisher_model.py index 64f6b8622d..3a17827eb4 100644 --- a/google/cloud/aiplatform_v1/types/publisher_model.py +++ b/google/cloud/aiplatform_v1/types/publisher_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/reasoning_engine.py b/google/cloud/aiplatform_v1/types/reasoning_engine.py index cd627fe49c..ff971621b6 100644 --- a/google/cloud/aiplatform_v1/types/reasoning_engine.py +++ b/google/cloud/aiplatform_v1/types/reasoning_engine.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/reasoning_engine_execution_service.py b/google/cloud/aiplatform_v1/types/reasoning_engine_execution_service.py index fe8fe31e20..da9669223c 100644 --- a/google/cloud/aiplatform_v1/types/reasoning_engine_execution_service.py +++ b/google/cloud/aiplatform_v1/types/reasoning_engine_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ "AsyncQueryReasoningEngineRequest", "AsyncQueryReasoningEngineOperationMetadata", "AsyncQueryReasoningEngineResponse", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", }, ) @@ -179,4 +181,36 @@ class AsyncQueryReasoningEngineResponse(proto.Message): ) +class CancelAsyncQueryReasoningEngineRequest(proto.Message): + r"""Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + Attributes: + name (str): + Required. The name of the ReasoningEngine resource to use. + Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`` + operation_name (str): + Required. The name of the longrunning operation returned + from AsyncQueryReasoningEngine. Format: + ``projects/{project}/locations/{location}/operations/{operation}`` + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + operation_name: str = proto.Field( + proto.STRING, + number=2, + ) + + +class CancelAsyncQueryReasoningEngineResponse(proto.Message): + r"""Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1/types/reasoning_engine_service.py b/google/cloud/aiplatform_v1/types/reasoning_engine_service.py index f4741ad41d..631f8951bb 100644 --- a/google/cloud/aiplatform_v1/types/reasoning_engine_service.py +++ b/google/cloud/aiplatform_v1/types/reasoning_engine_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/reservation_affinity.py b/google/cloud/aiplatform_v1/types/reservation_affinity.py index cf20d7aa76..cd09a7e692 100644 --- a/google/cloud/aiplatform_v1/types/reservation_affinity.py +++ b/google/cloud/aiplatform_v1/types/reservation_affinity.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/saved_query.py b/google/cloud/aiplatform_v1/types/saved_query.py index 16f51156c9..ebcd6e11a4 100644 --- a/google/cloud/aiplatform_v1/types/saved_query.py +++ b/google/cloud/aiplatform_v1/types/saved_query.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/schedule.py b/google/cloud/aiplatform_v1/types/schedule.py index 6009b3614e..64eaf35cb7 100644 --- a/google/cloud/aiplatform_v1/types/schedule.py +++ b/google/cloud/aiplatform_v1/types/schedule.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/schedule_service.py b/google/cloud/aiplatform_v1/types/schedule_service.py index 87888576eb..dbffd0c818 100644 --- a/google/cloud/aiplatform_v1/types/schedule_service.py +++ b/google/cloud/aiplatform_v1/types/schedule_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/service_networking.py b/google/cloud/aiplatform_v1/types/service_networking.py index 8e7893f4cf..89d25ca13d 100644 --- a/google/cloud/aiplatform_v1/types/service_networking.py +++ b/google/cloud/aiplatform_v1/types/service_networking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/session.py b/google/cloud/aiplatform_v1/types/session.py index 5b9655b1a9..38f4317c70 100644 --- a/google/cloud/aiplatform_v1/types/session.py +++ b/google/cloud/aiplatform_v1/types/session.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/session_service.py b/google/cloud/aiplatform_v1/types/session_service.py index 162fdddf4c..140cabda49 100644 --- a/google/cloud/aiplatform_v1/types/session_service.py +++ b/google/cloud/aiplatform_v1/types/session_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/specialist_pool.py b/google/cloud/aiplatform_v1/types/specialist_pool.py index 3bc9697c90..1e5015c80a 100644 --- a/google/cloud/aiplatform_v1/types/specialist_pool.py +++ b/google/cloud/aiplatform_v1/types/specialist_pool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/specialist_pool_service.py b/google/cloud/aiplatform_v1/types/specialist_pool_service.py index 7facfbf1d8..d20009d042 100644 --- a/google/cloud/aiplatform_v1/types/specialist_pool_service.py +++ b/google/cloud/aiplatform_v1/types/specialist_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/study.py b/google/cloud/aiplatform_v1/types/study.py index 02dca81529..0daafffb35 100644 --- a/google/cloud/aiplatform_v1/types/study.py +++ b/google/cloud/aiplatform_v1/types/study.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard.py b/google/cloud/aiplatform_v1/types/tensorboard.py index 8507cd9de9..0c0a60f8f9 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard.py +++ b/google/cloud/aiplatform_v1/types/tensorboard.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard_data.py b/google/cloud/aiplatform_v1/types/tensorboard_data.py index 23dff191b0..735ea9758b 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard_data.py +++ b/google/cloud/aiplatform_v1/types/tensorboard_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard_experiment.py b/google/cloud/aiplatform_v1/types/tensorboard_experiment.py index 43f634a0d4..894fe0826a 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard_experiment.py +++ b/google/cloud/aiplatform_v1/types/tensorboard_experiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard_run.py b/google/cloud/aiplatform_v1/types/tensorboard_run.py index d220ff56e6..118ae5247f 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard_run.py +++ b/google/cloud/aiplatform_v1/types/tensorboard_run.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard_service.py b/google/cloud/aiplatform_v1/types/tensorboard_service.py index 1aba2adfa6..12bc4e3a92 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard_service.py +++ b/google/cloud/aiplatform_v1/types/tensorboard_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tensorboard_time_series.py b/google/cloud/aiplatform_v1/types/tensorboard_time_series.py index 9ebd98aacc..102fb9c302 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard_time_series.py +++ b/google/cloud/aiplatform_v1/types/tensorboard_time_series.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tool.py b/google/cloud/aiplatform_v1/types/tool.py index dc2dc99760..66fe057181 100644 --- a/google/cloud/aiplatform_v1/types/tool.py +++ b/google/cloud/aiplatform_v1/types/tool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -96,6 +96,12 @@ class Tool(proto.Message): Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. + parallel_ai_search (google.cloud.aiplatform_v1.types.Tool.ParallelAiSearch): + Optional. If specified, Vertex AI will use + Parallel.ai to search for information to answer + user queries. The search results will be + grounded on Parallel.ai and presented to the + model for response generation code_execution (google.cloud.aiplatform_v1.types.Tool.CodeExecution): Optional. CodeExecution tool type. Enables the model to execute code as part of @@ -178,6 +184,44 @@ class GoogleSearch(proto.Message): enum="Tool.PhishBlockThreshold", ) + class ParallelAiSearch(proto.Message): + r"""ParallelAiSearch tool type. + A tool that uses the Parallel.ai search engine for grounding. + + Attributes: + api_key (str): + Optional. The API key for ParallelAiSearch. + If an API key is not provided, the system will + attempt to verify access by checking for an + active Parallel.ai subscription through the + Google Cloud Marketplace. + See + https://docs.parallel.ai/search/search-quickstart + for more details. + custom_configs (google.protobuf.struct_pb2.Struct): + Optional. Custom configs for ParallelAiSearch. This field + can be used to pass any parameter from the Parallel.ai + Search API. See the Parallel.ai documentation for the full + list of available parameters and their usage: + https://docs.parallel.ai/api-reference/search-beta/search + Currently only ``source_policy``, ``excerpts``, + ``max_results``, ``mode``, ``fetch_policy`` can be set via + this field. For example: { "source_policy": { + "include_domains": ["google.com", "wikipedia.org"], + "exclude_domains": ["example.com"] }, "fetch_policy": { + "max_age_seconds": 3600 } } + """ + + api_key: str = proto.Field( + proto.STRING, + number=1, + ) + custom_configs: struct_pb2.Struct = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) + class CodeExecution(proto.Message): r"""Tool that executes code generated by the model, and automatically returns the result to the model. @@ -259,6 +303,11 @@ class Environment(proto.Enum): number=6, message="EnterpriseWebSearch", ) + parallel_ai_search: ParallelAiSearch = proto.Field( + proto.MESSAGE, + number=13, + message=ParallelAiSearch, + ) code_execution: CodeExecution = proto.Field( proto.MESSAGE, number=4, diff --git a/google/cloud/aiplatform_v1/types/training_pipeline.py b/google/cloud/aiplatform_v1/types/training_pipeline.py index 1c21eaca55..74c83ad037 100644 --- a/google/cloud/aiplatform_v1/types/training_pipeline.py +++ b/google/cloud/aiplatform_v1/types/training_pipeline.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/tuning_job.py b/google/cloud/aiplatform_v1/types/tuning_job.py index 278063f2f1..93cd8166ac 100644 --- a/google/cloud/aiplatform_v1/types/tuning_job.py +++ b/google/cloud/aiplatform_v1/types/tuning_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/types.py b/google/cloud/aiplatform_v1/types/types.py index b40005875f..8414e3d4a5 100644 --- a/google/cloud/aiplatform_v1/types/types.py +++ b/google/cloud/aiplatform_v1/types/types.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/unmanaged_container_model.py b/google/cloud/aiplatform_v1/types/unmanaged_container_model.py index dbd2fff888..57f9f063ad 100644 --- a/google/cloud/aiplatform_v1/types/unmanaged_container_model.py +++ b/google/cloud/aiplatform_v1/types/unmanaged_container_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/usage_metadata.py b/google/cloud/aiplatform_v1/types/usage_metadata.py index 7e9fe542d8..ad13e39783 100644 --- a/google/cloud/aiplatform_v1/types/usage_metadata.py +++ b/google/cloud/aiplatform_v1/types/usage_metadata.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/user_action_reference.py b/google/cloud/aiplatform_v1/types/user_action_reference.py index 2c3fe8fd89..d27c60957c 100644 --- a/google/cloud/aiplatform_v1/types/user_action_reference.py +++ b/google/cloud/aiplatform_v1/types/user_action_reference.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/value.py b/google/cloud/aiplatform_v1/types/value.py index 8f1877d83a..13b3c5b39b 100644 --- a/google/cloud/aiplatform_v1/types/value.py +++ b/google/cloud/aiplatform_v1/types/value.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/vertex_rag_data.py b/google/cloud/aiplatform_v1/types/vertex_rag_data.py index d739d44a1b..a5522e4573 100644 --- a/google/cloud/aiplatform_v1/types/vertex_rag_data.py +++ b/google/cloud/aiplatform_v1/types/vertex_rag_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/vertex_rag_data_service.py b/google/cloud/aiplatform_v1/types/vertex_rag_data_service.py index 003164b00c..a6e49eeaf1 100644 --- a/google/cloud/aiplatform_v1/types/vertex_rag_data_service.py +++ b/google/cloud/aiplatform_v1/types/vertex_rag_data_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/vertex_rag_service.py b/google/cloud/aiplatform_v1/types/vertex_rag_service.py index 69d85d545b..13261ceff4 100644 --- a/google/cloud/aiplatform_v1/types/vertex_rag_service.py +++ b/google/cloud/aiplatform_v1/types/vertex_rag_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1/types/vizier_service.py b/google/cloud/aiplatform_v1/types/vizier_service.py index 523522e2fd..460ea0e89f 100644 --- a/google/cloud/aiplatform_v1/types/vizier_service.py +++ b/google/cloud/aiplatform_v1/types/vizier_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/__init__.py b/google/cloud/aiplatform_v1beta1/__init__.py index 5d2e8430b9..3c3201dc8f 100644 --- a/google/cloud/aiplatform_v1beta1/__init__.py +++ b/google/cloud/aiplatform_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,12 +20,7 @@ __version__ = package_version.__version__ -if sys.version_info >= (3, 8): # pragma: NO COVER - from importlib import metadata -else: # pragma: NO COVER - # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove - # this code path once we drop support for Python 3.7 - import importlib_metadata as metadata +from importlib import metadata from .services.dataset_service import DatasetServiceClient @@ -106,6 +101,12 @@ from .services.reasoning_engine_execution_service import ( ReasoningEngineExecutionServiceAsyncClient, ) +from .services.reasoning_engine_runtime_revision_service import ( + ReasoningEngineRuntimeRevisionServiceClient, +) +from .services.reasoning_engine_runtime_revision_service import ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, +) from .services.reasoning_engine_service import ReasoningEngineServiceClient from .services.reasoning_engine_service import ReasoningEngineServiceAsyncClient from .services.schedule_service import ScheduleServiceClient @@ -1122,9 +1123,31 @@ ) from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineRequest from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineResponse +from .types.reasoning_engine_execution_service import ( + CancelAsyncQueryReasoningEngineRequest, +) +from .types.reasoning_engine_execution_service import ( + CancelAsyncQueryReasoningEngineResponse, +) from .types.reasoning_engine_execution_service import QueryReasoningEngineRequest from .types.reasoning_engine_execution_service import QueryReasoningEngineResponse from .types.reasoning_engine_execution_service import StreamQueryReasoningEngineRequest +from .types.reasoning_engine_runtime_revision import ReasoningEngineRuntimeRevision +from .types.reasoning_engine_runtime_revision_service import ( + DeleteReasoningEngineRuntimeRevisionOperationMetadata, +) +from .types.reasoning_engine_runtime_revision_service import ( + DeleteReasoningEngineRuntimeRevisionRequest, +) +from .types.reasoning_engine_runtime_revision_service import ( + GetReasoningEngineRuntimeRevisionRequest, +) +from .types.reasoning_engine_runtime_revision_service import ( + ListReasoningEngineRuntimeRevisionsRequest, +) +from .types.reasoning_engine_runtime_revision_service import ( + ListReasoningEngineRuntimeRevisionsResponse, +) from .types.reasoning_engine_service import CreateReasoningEngineOperationMetadata from .types.reasoning_engine_service import CreateReasoningEngineRequest from .types.reasoning_engine_service import DeleteReasoningEngineRequest @@ -1408,27 +1431,16 @@ # functions above. We do equivalent checks manually. try: import warnings - import sys _py_version_str = sys.version.split()[0] _package_label = "google.cloud.aiplatform_v1beta1" - if sys.version_info < (3, 9): + if sys.version_info < (3, 10): warnings.warn( "You are using a non-supported Python version " + f"({_py_version_str}). Google will not post any further " + f"updates to {_package_label} supporting this Python version. " + "Please upgrade to the latest Python version, or at " - + f"least to Python 3.9, and then update {_package_label}.", - FutureWarning, - ) - if sys.version_info[:2] == (3, 9): - warnings.warn( - f"You are using a Python version ({_py_version_str}) " - + f"which Google will stop supporting in {_package_label} in " - + "January 2026. Please " - + "upgrade to the latest Python version, or at " - + "least to Python 3.10, before then, and " - + f"then update {_package_label}.", + + f"least to Python 3.10, and then update {_package_label}.", FutureWarning, ) @@ -1524,6 +1536,7 @@ def _get_version(dependency_name): "PipelineServiceAsyncClient", "PredictionServiceAsyncClient", "ReasoningEngineExecutionServiceAsyncClient", + "ReasoningEngineRuntimeRevisionServiceAsyncClient", "ReasoningEngineServiceAsyncClient", "ScheduleServiceAsyncClient", "SessionServiceAsyncClient", @@ -1626,6 +1639,8 @@ def _get_version(dependency_name): "BlurBaselineConfig", "BoolArray", "CachedContent", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", "CancelBatchPredictionJobRequest", "CancelCustomJobRequest", "CancelDataLabelingJobRequest", @@ -1819,6 +1834,8 @@ def _get_version(dependency_name): "DeleteRagFileRequest", "DeleteRagMetadataRequest", "DeleteReasoningEngineRequest", + "DeleteReasoningEngineRuntimeRevisionOperationMetadata", + "DeleteReasoningEngineRuntimeRevisionRequest", "DeleteSavedQueryRequest", "DeleteScheduleRequest", "DeleteSessionRequest", @@ -2064,6 +2081,7 @@ def _get_version(dependency_name): "GetRagFileRequest", "GetRagMetadataRequest", "GetReasoningEngineRequest", + "GetReasoningEngineRuntimeRevisionRequest", "GetScheduleRequest", "GetSessionRequest", "GetSpecialistPoolRequest", @@ -2228,6 +2246,8 @@ def _get_version(dependency_name): "ListRagFilesResponse", "ListRagMetadataRequest", "ListRagMetadataResponse", + "ListReasoningEngineRuntimeRevisionsRequest", + "ListReasoningEngineRuntimeRevisionsResponse", "ListReasoningEnginesRequest", "ListReasoningEnginesResponse", "ListSavedQueriesRequest", @@ -2483,6 +2503,8 @@ def _get_version(dependency_name): "ReasoningEngine", "ReasoningEngineContextSpec", "ReasoningEngineExecutionServiceClient", + "ReasoningEngineRuntimeRevision", + "ReasoningEngineRuntimeRevisionServiceClient", "ReasoningEngineServiceClient", "ReasoningEngineSpec", "RebaseTunedModelOperationMetadata", diff --git a/google/cloud/aiplatform_v1beta1/gapic_metadata.json b/google/cloud/aiplatform_v1beta1/gapic_metadata.json index 0903836a72..ecf47ccdbd 100644 --- a/google/cloud/aiplatform_v1beta1/gapic_metadata.json +++ b/google/cloud/aiplatform_v1beta1/gapic_metadata.json @@ -5355,6 +5355,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" @@ -5375,6 +5380,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" @@ -5395,6 +5405,11 @@ "async_query_reasoning_engine" ] }, + "CancelAsyncQueryReasoningEngine": { + "methods": [ + "cancel_async_query_reasoning_engine" + ] + }, "QueryReasoningEngine": { "methods": [ "query_reasoning_engine" @@ -5409,6 +5424,70 @@ } } }, + "ReasoningEngineRuntimeRevisionService": { + "clients": { + "grpc": { + "libraryClient": "ReasoningEngineRuntimeRevisionServiceClient", + "rpcs": { + "DeleteReasoningEngineRuntimeRevision": { + "methods": [ + "delete_reasoning_engine_runtime_revision" + ] + }, + "GetReasoningEngineRuntimeRevision": { + "methods": [ + "get_reasoning_engine_runtime_revision" + ] + }, + "ListReasoningEngineRuntimeRevisions": { + "methods": [ + "list_reasoning_engine_runtime_revisions" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ReasoningEngineRuntimeRevisionServiceAsyncClient", + "rpcs": { + "DeleteReasoningEngineRuntimeRevision": { + "methods": [ + "delete_reasoning_engine_runtime_revision" + ] + }, + "GetReasoningEngineRuntimeRevision": { + "methods": [ + "get_reasoning_engine_runtime_revision" + ] + }, + "ListReasoningEngineRuntimeRevisions": { + "methods": [ + "list_reasoning_engine_runtime_revisions" + ] + } + } + }, + "rest": { + "libraryClient": "ReasoningEngineRuntimeRevisionServiceClient", + "rpcs": { + "DeleteReasoningEngineRuntimeRevision": { + "methods": [ + "delete_reasoning_engine_runtime_revision" + ] + }, + "GetReasoningEngineRuntimeRevision": { + "methods": [ + "get_reasoning_engine_runtime_revision" + ] + }, + "ListReasoningEngineRuntimeRevisions": { + "methods": [ + "list_reasoning_engine_runtime_revisions" + ] + } + } + } + } + }, "ReasoningEngineService": { "clients": { "grpc": { diff --git a/google/cloud/aiplatform_v1beta1/services/__init__.py b/google/cloud/aiplatform_v1beta1/services/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/google/cloud/aiplatform_v1beta1/services/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/__init__.py index 42f97659ee..47469dadfd 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py index dccbc57951..b8494c9176 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -231,7 +231,7 @@ def transport(self) -> DatasetServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -380,11 +380,11 @@ async def sample_create_dataset(): ) # Make the request - operation = client.create_dataset(request=request) + operation = await client.create_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -885,11 +885,11 @@ async def sample_delete_dataset(): ) # Make the request - operation = client.delete_dataset(request=request) + operation = await client.delete_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1025,11 +1025,11 @@ async def sample_import_data(): ) # Make the request - operation = client.import_data(request=request) + operation = await client.import_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1165,11 +1165,11 @@ async def sample_export_data(): ) # Make the request - operation = client.export_data(request=request) + operation = await client.export_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1306,11 +1306,11 @@ async def sample_create_dataset_version(): ) # Make the request - operation = client.create_dataset_version(request=request) + operation = await client.create_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1576,11 +1576,11 @@ async def sample_delete_dataset_version(): ) # Make the request - operation = client.delete_dataset_version(request=request) + operation = await client.delete_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1951,11 +1951,11 @@ async def sample_restore_dataset_version(): ) # Make the request - operation = client.restore_dataset_version(request=request) + operation = await client.restore_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2434,11 +2434,11 @@ async def sample_delete_saved_query(): ) # Make the request - operation = client.delete_saved_query(request=request) + operation = await client.delete_saved_query(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2812,11 +2812,11 @@ async def sample_assess_data(): ) # Make the request - operation = client.assess_data(request=request) + operation = await client.assess_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2914,11 +2914,11 @@ async def sample_assemble_data(): ) # Make the request - operation = client.assemble_data(request=request) + operation = await client.assemble_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2986,7 +2986,7 @@ async def sample_assemble_data(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3012,8 +3012,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3022,7 +3026,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3030,7 +3034,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3041,7 +3045,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3067,8 +3071,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3077,7 +3085,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3085,7 +3093,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3096,7 +3104,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3126,8 +3134,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3136,7 +3148,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3144,7 +3156,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3152,7 +3164,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3181,8 +3193,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3191,7 +3207,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3199,7 +3215,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3207,7 +3223,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3239,8 +3255,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3249,7 +3269,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3257,7 +3277,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3268,7 +3288,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3360,8 +3380,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3370,7 +3394,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3378,7 +3404,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3389,7 +3415,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3482,8 +3508,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3492,7 +3522,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3500,7 +3532,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3511,7 +3543,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3542,8 +3574,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3554,7 +3590,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3562,7 +3600,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3573,7 +3611,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3599,8 +3637,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3609,7 +3651,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3617,7 +3659,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3628,7 +3670,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3654,8 +3696,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3664,7 +3710,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3672,7 +3718,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py index d1a653e595..ec5e683981 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,7 @@ from .transports.grpc_asyncio import DatasetServiceGrpcAsyncIOTransport from .transports.rest import DatasetServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncDatasetServiceRestTransport @@ -146,7 +147,7 @@ class DatasetServiceClient(metaclass=DatasetServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -154,7 +155,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -164,6 +165,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -681,7 +686,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -778,7 +783,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -874,7 +879,7 @@ def __init__( self._universe_domain = DatasetServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3598,7 +3603,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3624,8 +3629,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3634,7 +3643,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3643,7 +3652,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3657,7 +3666,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3683,8 +3692,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3693,7 +3706,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3702,7 +3715,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3716,7 +3729,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3746,8 +3759,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3756,7 +3773,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3764,7 +3781,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3772,7 +3789,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3801,8 +3818,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3811,7 +3832,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3819,7 +3840,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3827,7 +3848,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3859,8 +3880,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3869,7 +3894,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3878,7 +3903,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3892,7 +3917,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3984,8 +4009,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3994,7 +4023,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4003,7 +4034,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4017,7 +4048,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4110,8 +4141,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4120,7 +4155,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4129,7 +4166,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4143,7 +4180,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4174,8 +4211,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4184,7 +4225,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4193,7 +4236,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4207,7 +4250,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4233,8 +4276,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4243,7 +4290,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4252,7 +4299,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4266,7 +4313,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4292,8 +4339,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4302,7 +4353,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4311,7 +4362,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py index 267fc40306..dbc4bec256 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/README.rst index 3282d37876..ef85e2ac67 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`DatasetServiceTransport` is the ABC for all transports. -- public child `DatasetServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `DatasetServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseDatasetServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `DatasetServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``DatasetServiceTransport`` is the ABC for all transports. + +- public child ``DatasetServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``DatasetServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseDatasetServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``DatasetServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/__init__.py index 508606defe..9a876a0c59 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/base.py index 2b007d154c..0ac874a273 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py index 75cf63b518..4e4de5779a 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py index ff1e2cf74f..cb906cb9fb 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py index 5586c52f9b..e93f98d466 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1600,6 +1600,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[DatasetServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2001,6 +2007,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2403,6 +2413,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2853,6 +2867,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3299,6 +3317,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3745,6 +3767,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py index d69b2f56b0..02f078c773 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1603,6 +1603,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncDatasetServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -5562,6 +5564,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -5964,6 +5970,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6414,6 +6424,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6860,6 +6874,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -7306,6 +7324,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py index 29505e10a5..0e4993e976 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1946,6 +1946,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2367,6 +2371,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2836,6 +2844,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3301,6 +3313,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3766,6 +3782,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/__init__.py index 1a6e5f48e7..ee5fc900ff 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py index 171b73e98d..b9857feed3 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -234,7 +234,7 @@ def transport(self) -> DeploymentResourcePoolServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -394,11 +394,11 @@ async def sample_create_deployment_resource_pool(): ) # Make the request - operation = client.create_deployment_resource_pool(request=request) + operation = await client.create_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -825,11 +825,11 @@ async def sample_update_deployment_resource_pool(): ) # Make the request - operation = client.update_deployment_resource_pool(request=request) + operation = await client.update_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -982,11 +982,11 @@ async def sample_delete_deployment_resource_pool(): ) # Make the request - operation = client.delete_deployment_resource_pool(request=request) + operation = await client.delete_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1229,7 +1229,7 @@ async def sample_query_deployed_models(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1255,8 +1255,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1265,7 +1269,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1273,7 +1277,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1284,7 +1288,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1310,8 +1314,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1320,7 +1328,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1328,7 +1336,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1339,7 +1347,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1369,8 +1377,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1379,7 +1391,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1387,7 +1399,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1395,7 +1407,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1424,8 +1436,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1434,7 +1450,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1442,7 +1458,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1450,7 +1466,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1482,8 +1498,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1492,7 +1512,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1500,7 +1520,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1511,7 +1531,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1603,8 +1623,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1613,7 +1637,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1621,7 +1647,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1632,7 +1658,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1725,8 +1751,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1735,7 +1765,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1743,7 +1775,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1754,7 +1786,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1785,8 +1817,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1797,7 +1833,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1805,7 +1843,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1816,7 +1854,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1842,8 +1880,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1852,7 +1894,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1860,7 +1902,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1871,7 +1913,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1897,8 +1939,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1907,7 +1953,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1915,7 +1961,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py index d8dee60270..24f7b0ec52 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,7 @@ from .transports.grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport from .transports.rest import DeploymentResourcePoolServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncDeploymentResourcePoolServiceRestTransport @@ -149,7 +150,7 @@ class DeploymentResourcePoolServiceClient( """A service that manages the DeploymentResourcePool resource.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -157,7 +158,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -167,6 +168,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -544,7 +549,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -643,7 +648,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -747,7 +752,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1764,7 +1769,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1790,8 +1795,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1800,7 +1809,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1809,7 +1818,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1823,7 +1832,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1849,8 +1858,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1859,7 +1872,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1868,7 +1881,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1882,7 +1895,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1912,8 +1925,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1922,7 +1939,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1930,7 +1947,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1938,7 +1955,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1967,8 +1984,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1977,7 +1998,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1985,7 +2006,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1993,7 +2014,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2025,8 +2046,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2035,7 +2060,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2044,7 +2069,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2058,7 +2083,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2150,8 +2175,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2160,7 +2189,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2169,7 +2200,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2183,7 +2214,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2276,8 +2307,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2286,7 +2321,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2295,7 +2332,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2309,7 +2346,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2340,8 +2377,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2350,7 +2391,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2359,7 +2402,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2373,7 +2416,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2399,8 +2442,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2409,7 +2456,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2418,7 +2465,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2432,7 +2479,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2458,8 +2505,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2468,7 +2519,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2477,7 +2528,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py index 12f860b499..96935f90e2 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/README.rst index d947efaa15..4a0ec44407 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`DeploymentResourcePoolServiceTransport` is the ABC for all transports. -- public child `DeploymentResourcePoolServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `DeploymentResourcePoolServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseDeploymentResourcePoolServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `DeploymentResourcePoolServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``DeploymentResourcePoolServiceTransport`` is the ABC for all transports. + +- public child ``DeploymentResourcePoolServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``DeploymentResourcePoolServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseDeploymentResourcePoolServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``DeploymentResourcePoolServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/__init__.py index dad07c12b9..c5296b3c0c 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/base.py index d1f67029b5..e5484a9d08 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py index 220fdac58a..2724e38a1c 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py index 03c7c7e64a..26c998fda7 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py index fb95b86af1..20d9a1ddb2 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -754,6 +754,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[DeploymentResourcePoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1157,6 +1163,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1559,6 +1569,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2009,6 +2023,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2455,6 +2473,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2901,6 +2923,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py index f9e784e498..edabe3292e 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -755,6 +755,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncDeploymentResourcePoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2256,6 +2258,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2658,6 +2664,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3108,6 +3118,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3554,6 +3568,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4000,6 +4018,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py index 5c082506f1..f0b8f213f7 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1151,6 +1151,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1572,6 +1576,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2041,6 +2049,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2506,6 +2518,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2971,6 +2987,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/__init__.py index 820efd7010..d9d6e78fee 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py index df0f5adbf9..841f22b19c 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -217,7 +217,7 @@ def transport(self) -> EndpointServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -367,11 +367,11 @@ async def sample_create_endpoint(): ) # Make the request - operation = client.create_endpoint(request=request) + operation = await client.create_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -896,11 +896,11 @@ async def sample_update_endpoint_long_running(): ) # Make the request - operation = client.update_endpoint_long_running(request=request) + operation = await client.update_endpoint_long_running(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1025,11 +1025,11 @@ async def sample_delete_endpoint(): ) # Make the request - operation = client.delete_endpoint(request=request) + operation = await client.delete_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1166,11 +1166,11 @@ async def sample_deploy_model(): ) # Make the request - operation = client.deploy_model(request=request) + operation = await client.deploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1333,11 +1333,11 @@ async def sample_undeploy_model(): ) # Make the request - operation = client.undeploy_model(request=request) + operation = await client.undeploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1497,11 +1497,11 @@ async def sample_mutate_deployed_model(): ) # Make the request - operation = client.mutate_deployed_model(request=request) + operation = await client.mutate_deployed_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1660,11 +1660,11 @@ async def sample_set_publisher_model_config(): ) # Make the request - operation = client.set_publisher_model_config(request=request) + operation = await client.set_publisher_model_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1878,7 +1878,7 @@ async def sample_fetch_publisher_model_config(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1904,8 +1904,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1914,7 +1918,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1922,7 +1926,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1933,7 +1937,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1959,8 +1963,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1969,7 +1977,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1977,7 +1985,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1988,7 +1996,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2018,8 +2026,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2028,7 +2040,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2036,7 +2048,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2044,7 +2056,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2073,8 +2085,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2083,7 +2099,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2091,7 +2107,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2099,7 +2115,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2131,8 +2147,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2141,7 +2161,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2149,7 +2169,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2160,7 +2180,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2252,8 +2272,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2262,7 +2286,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2270,7 +2296,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2281,7 +2307,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2374,8 +2400,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2384,7 +2414,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2392,7 +2424,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2403,7 +2435,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2434,8 +2466,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2446,7 +2482,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2454,7 +2492,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2465,7 +2503,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2491,8 +2529,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2501,7 +2543,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2509,7 +2551,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2520,7 +2562,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2546,8 +2588,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2556,7 +2602,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2564,7 +2610,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py index 45ab3fa274..dd9b75c6b3 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import EndpointServiceGrpcAsyncIOTransport from .transports.rest import EndpointServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncEndpointServiceRestTransport @@ -138,7 +139,7 @@ class EndpointServiceClient(metaclass=EndpointServiceClientMeta): """A service for managing Vertex AI's Endpoints.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -570,7 +575,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -667,7 +672,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -765,7 +770,7 @@ def __init__( self._universe_domain = EndpointServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2424,7 +2429,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2450,8 +2455,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2460,7 +2469,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2469,7 +2478,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2483,7 +2492,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2509,8 +2518,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2519,7 +2532,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2528,7 +2541,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2542,7 +2555,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2572,8 +2585,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2582,7 +2599,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2590,7 +2607,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2598,7 +2615,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2627,8 +2644,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2637,7 +2658,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2645,7 +2666,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2653,7 +2674,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2685,8 +2706,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2695,7 +2720,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2704,7 +2729,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2718,7 +2743,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2810,8 +2835,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2820,7 +2849,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2829,7 +2860,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2843,7 +2874,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2936,8 +2967,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2946,7 +2981,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2955,7 +2992,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2969,7 +3006,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3000,8 +3037,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3010,7 +3051,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3019,7 +3062,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3033,7 +3076,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3059,8 +3102,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3069,7 +3116,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3078,7 +3125,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3092,7 +3139,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3118,8 +3165,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3128,7 +3179,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3137,7 +3188,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py index 5266504b86..7b3f570d09 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/README.rst index ac4deff521..b5238ac537 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`EndpointServiceTransport` is the ABC for all transports. -- public child `EndpointServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `EndpointServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseEndpointServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `EndpointServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``EndpointServiceTransport`` is the ABC for all transports. + +- public child ``EndpointServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``EndpointServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseEndpointServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``EndpointServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/__init__.py index 77d57ff6c3..be24ac1317 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/base.py index b8b5f0652a..610fd0d197 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py index 55b0a555df..76bdc8dcdd 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py index 9a772d5625..dd7b9baea0 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py index 06d0b5914f..e329690199 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1021,6 +1021,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[EndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1422,6 +1428,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1824,6 +1834,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2274,6 +2288,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2720,6 +2738,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3166,6 +3188,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py index 7ef61e7240..32ba5bb7f7 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1022,6 +1022,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -3339,6 +3341,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3741,6 +3747,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4191,6 +4201,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4637,6 +4651,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -5083,6 +5101,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py index 79267fad6d..da0b670545 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1413,6 +1413,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1834,6 +1838,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2303,6 +2311,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2768,6 +2780,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3233,6 +3249,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/__init__.py index f2bfe018de..fc89b4197a 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py index 5745b33132..49e94f0303 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -191,7 +191,7 @@ def transport(self) -> EvaluationServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -438,11 +438,11 @@ async def sample_evaluate_dataset(): ) # Make the request - operation = client.evaluate_dataset(request=request) + operation = await client.evaluate_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -608,7 +608,7 @@ async def sample_generate_instance_rubrics(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -634,8 +634,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -644,7 +648,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -652,7 +656,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -663,7 +667,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -689,8 +693,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -699,7 +707,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -707,7 +715,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -718,7 +726,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -748,8 +756,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -758,7 +770,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -766,7 +778,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -774,7 +786,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -803,8 +815,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -813,7 +829,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -821,7 +837,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -829,7 +845,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -861,8 +877,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -871,7 +891,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -879,7 +899,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -890,7 +910,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -982,8 +1002,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -992,7 +1016,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1000,7 +1026,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1011,7 +1037,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1104,8 +1130,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1114,7 +1144,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1122,7 +1154,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1133,7 +1165,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1164,8 +1196,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1176,7 +1212,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1184,7 +1222,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1195,7 +1233,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1221,8 +1259,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1231,7 +1273,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1239,7 +1281,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1250,7 +1292,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1276,8 +1318,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1286,7 +1332,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1294,7 +1340,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py index a26708a1c5..0c0cffa58e 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -74,6 +74,7 @@ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport from .transports.rest import EvaluationServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncEvaluationServiceRestTransport @@ -130,7 +131,7 @@ class EvaluationServiceClient(metaclass=EvaluationServiceClientMeta): """Vertex AI Online Evaluation Service.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -138,7 +139,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -148,6 +149,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -455,7 +460,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -552,7 +557,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -652,7 +657,7 @@ def __init__( self._universe_domain = EvaluationServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1091,7 +1096,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1117,8 +1122,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1127,7 +1136,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1136,7 +1145,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1150,7 +1159,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1176,8 +1185,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1186,7 +1199,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1195,7 +1208,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1209,7 +1222,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1239,8 +1252,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1249,7 +1266,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1257,7 +1274,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1265,7 +1282,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1294,8 +1311,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1304,7 +1325,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1312,7 +1333,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1320,7 +1341,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1352,8 +1373,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1362,7 +1387,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1371,7 +1396,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1385,7 +1410,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1477,8 +1502,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1487,7 +1516,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1496,7 +1527,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1510,7 +1541,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1603,8 +1634,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1613,7 +1648,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1622,7 +1659,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1636,7 +1673,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1667,8 +1704,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1677,7 +1718,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1686,7 +1729,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1700,7 +1743,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1726,8 +1769,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1736,7 +1783,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1745,7 +1792,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1759,7 +1806,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1785,8 +1832,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1795,7 +1846,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1804,7 +1855,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/README.rst index b012f0c5c1..21b6cc6a5f 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`EvaluationServiceTransport` is the ABC for all transports. -- public child `EvaluationServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `EvaluationServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseEvaluationServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `EvaluationServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``EvaluationServiceTransport`` is the ABC for all transports. + +- public child ``EvaluationServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``EvaluationServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseEvaluationServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``EvaluationServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/__init__.py index 65d8722e27..63e31c93f8 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/base.py index bfd00ac736..cadf9eed97 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py index 2340ce9cbe..1dd2bc8770 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py index 7df6a8036d..b24c08ec6d 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py index b6d5452984..09b3799100 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -576,6 +576,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[EvaluationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -977,6 +983,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1379,6 +1389,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1829,6 +1843,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2275,6 +2293,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2721,6 +2743,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py index 2b873c58a2..2438031c4e 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -577,6 +577,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncEvaluationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1547,6 +1549,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1949,6 +1955,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2399,6 +2409,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2845,6 +2859,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3291,6 +3309,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py index 3bc5eb9b4d..f6b7da35b9 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1008,6 +1008,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1429,6 +1433,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1898,6 +1906,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2363,6 +2375,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2828,6 +2844,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/__init__.py index c7c54d0a12..da379dd30f 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/async_client.py index 3cb2091c8a..2cb43be5f7 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -198,7 +198,7 @@ def transport(self) -> ExampleStoreServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -352,11 +352,11 @@ async def sample_create_example_store(): ) # Make the request - operation = client.create_example_store(request=request) + operation = await client.create_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -609,11 +609,11 @@ async def sample_update_example_store(): ) # Make the request - operation = client.update_example_store(request=request) + operation = await client.update_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -754,11 +754,11 @@ async def sample_delete_example_store(): ) # Make the request - operation = client.delete_example_store(request=request) + operation = await client.delete_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1372,7 +1372,7 @@ async def sample_fetch_examples(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1398,8 +1398,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1408,7 +1412,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1416,7 +1420,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1427,7 +1431,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1453,8 +1457,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1463,7 +1471,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1471,7 +1479,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1482,7 +1490,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1512,8 +1520,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1522,7 +1534,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1530,7 +1542,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1538,7 +1550,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1567,8 +1579,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1577,7 +1593,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1585,7 +1601,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1593,7 +1609,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1625,8 +1641,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1635,7 +1655,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1643,7 +1663,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1674,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1746,8 +1766,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1756,7 +1780,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1764,7 +1790,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1775,7 +1801,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1868,8 +1894,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1878,7 +1908,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1886,7 +1918,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1897,7 +1929,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1928,8 +1960,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1940,7 +1976,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1948,7 +1986,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1959,7 +1997,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1985,8 +2023,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1995,7 +2037,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2003,7 +2045,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2014,7 +2056,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2040,8 +2082,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2050,7 +2096,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2058,7 +2104,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/client.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/client.py index d6b31d619f..a0d5acb17c 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ from .transports.grpc_asyncio import ExampleStoreServiceGrpcAsyncIOTransport from .transports.rest import ExampleStoreServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncExampleStoreServiceRestTransport @@ -135,7 +136,7 @@ class ExampleStoreServiceClient(metaclass=ExampleStoreServiceClientMeta): """A service for managing and retrieving few-shot examples.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -143,7 +144,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -153,6 +154,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -460,7 +465,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -557,7 +562,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -657,7 +662,7 @@ def __init__( self._universe_domain = ExampleStoreServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1834,7 +1839,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1860,8 +1865,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1870,7 +1879,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1879,7 +1888,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1893,7 +1902,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1919,8 +1928,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1929,7 +1942,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1938,7 +1951,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1952,7 +1965,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1982,8 +1995,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1992,7 +2009,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2000,7 +2017,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2008,7 +2025,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2037,8 +2054,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2047,7 +2068,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2055,7 +2076,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2063,7 +2084,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2095,8 +2116,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2105,7 +2130,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2114,7 +2139,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2128,7 +2153,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2220,8 +2245,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2230,7 +2259,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2239,7 +2270,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2253,7 +2284,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2346,8 +2377,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2356,7 +2391,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2365,7 +2402,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2379,7 +2416,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2410,8 +2447,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2420,7 +2461,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2429,7 +2472,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2443,7 +2486,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2469,8 +2512,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2479,7 +2526,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2488,7 +2535,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2502,7 +2549,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2528,8 +2575,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2538,7 +2589,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2547,7 +2598,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/pagers.py index 2a048f3b5d..e095f61d6e 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/README.rst index 7036d2b357..c87975f904 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ExampleStoreServiceTransport` is the ABC for all transports. -- public child `ExampleStoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ExampleStoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseExampleStoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ExampleStoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ExampleStoreServiceTransport`` is the ABC for all transports. + +- public child ``ExampleStoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ExampleStoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseExampleStoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ExampleStoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/__init__.py index 719a3fb4ce..968204c41a 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/base.py index b8d852e6ef..9aedb66c04 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc.py index 0016475f68..f0290c320c 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc_asyncio.py index 70dde46b75..4045a3edb3 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest.py index 0850280fc0..aca14146fc 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -928,6 +928,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ExampleStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1329,6 +1335,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1731,6 +1741,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2181,6 +2195,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2627,6 +2645,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3073,6 +3095,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_asyncio.py index 7ad9713367..98314176d2 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -929,6 +929,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncExampleStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2895,6 +2897,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3297,6 +3303,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3747,6 +3757,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4193,6 +4207,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4639,6 +4657,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_base.py index c1c050cf2a..a2425e4432 100644 --- a/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/example_store_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1310,6 +1310,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1731,6 +1735,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2200,6 +2208,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2665,6 +2677,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3130,6 +3146,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/__init__.py index 930a03e72e..86cce682a1 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py index c448d87a5e..2eabecbe99 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> ExtensionExecutionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -579,7 +579,7 @@ async def sample_query_extension(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -605,8 +605,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -615,7 +619,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -623,7 +627,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -634,7 +638,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -660,8 +664,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -670,7 +678,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -678,7 +686,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -689,7 +697,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -719,8 +727,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -729,7 +741,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -737,7 +749,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -745,7 +757,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -774,8 +786,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -784,7 +800,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -792,7 +808,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -800,7 +816,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -832,8 +848,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -842,7 +862,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -850,7 +870,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -861,7 +881,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -953,8 +973,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -963,7 +987,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -971,7 +997,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -982,7 +1008,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1075,8 +1101,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1085,7 +1115,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1093,7 +1125,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1104,7 +1136,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1135,8 +1167,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1147,7 +1183,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1155,7 +1193,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1166,7 +1204,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1192,8 +1230,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1202,7 +1244,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1210,7 +1252,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1221,7 +1263,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1247,8 +1289,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1257,7 +1303,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1265,7 +1311,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py index 4756748b64..0671e29a46 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ from .transports.grpc_asyncio import ExtensionExecutionServiceGrpcAsyncIOTransport from .transports.rest import ExtensionExecutionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncExtensionExecutionServiceRestTransport @@ -130,7 +131,7 @@ class ExtensionExecutionServiceClient(metaclass=ExtensionExecutionServiceClientM """A service for Extension execution.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -138,7 +139,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -148,6 +149,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -477,7 +482,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -576,7 +581,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -678,7 +683,7 @@ def __init__( self._universe_domain = ExtensionExecutionServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1070,7 +1075,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1096,8 +1101,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1106,7 +1115,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1115,7 +1124,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1129,7 +1138,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1155,8 +1164,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1165,7 +1178,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1174,7 +1187,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1188,7 +1201,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1218,8 +1231,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1228,7 +1245,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1236,7 +1253,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1244,7 +1261,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1273,8 +1290,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1283,7 +1304,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1291,7 +1312,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1299,7 +1320,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1331,8 +1352,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1341,7 +1366,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1350,7 +1375,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1364,7 +1389,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1456,8 +1481,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1466,7 +1495,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1475,7 +1506,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1489,7 +1520,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1582,8 +1613,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1592,7 +1627,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1601,7 +1638,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1615,7 +1652,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1646,8 +1683,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1656,7 +1697,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1665,7 +1708,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1679,7 +1722,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1705,8 +1748,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1715,7 +1762,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1724,7 +1771,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1738,7 +1785,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1764,8 +1811,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1774,7 +1825,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1783,7 +1834,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/README.rst index c26742c17e..b1d519da43 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ExtensionExecutionServiceTransport` is the ABC for all transports. -- public child `ExtensionExecutionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ExtensionExecutionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseExtensionExecutionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ExtensionExecutionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ExtensionExecutionServiceTransport`` is the ABC for all transports. + +- public child ``ExtensionExecutionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ExtensionExecutionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseExtensionExecutionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ExtensionExecutionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/__init__.py index 17c35098d4..0dbbc7848e 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/base.py index 9675e3ac4a..097c35df69 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py index 41857cd963..7ee33ec6e5 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -189,6 +189,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py index dba08036ae..3336cf3271 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -240,6 +240,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py index cd410b4083..e5b7c25b76 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -520,6 +520,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ExtensionExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py index cc40ff503b..9e38f43ba7 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -520,6 +520,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncExtensionExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py index dc51ff66b2..7b3aa3bb6c 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -936,6 +936,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1357,6 +1361,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1826,6 +1834,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2291,6 +2303,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2756,6 +2772,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/__init__.py index 804f2c0850..65373a4d17 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py index 71ccd3bd90..b285e7a06e 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -216,7 +216,7 @@ def transport(self) -> ExtensionRegistryServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -375,11 +375,11 @@ async def sample_import_extension(): ) # Make the request - operation = client.import_extension(request=request) + operation = await client.import_extension(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -896,11 +896,11 @@ async def sample_delete_extension(): ) # Make the request - operation = client.delete_extension(request=request) + operation = await client.delete_extension(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1000,7 +1000,7 @@ async def sample_delete_extension(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1026,8 +1026,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1036,7 +1040,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1044,7 +1048,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1055,7 +1059,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1081,8 +1085,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1091,7 +1099,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1099,7 +1107,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1110,7 +1118,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1140,8 +1148,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1150,7 +1162,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1158,7 +1170,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1166,7 +1178,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1195,8 +1207,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1205,7 +1221,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1213,7 +1229,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1221,7 +1237,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1253,8 +1269,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1263,7 +1283,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1271,7 +1291,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1282,7 +1302,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1374,8 +1394,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1384,7 +1408,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1392,7 +1418,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1403,7 +1429,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1496,8 +1522,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1506,7 +1536,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1514,7 +1546,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1525,7 +1557,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1556,8 +1588,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1568,7 +1604,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1576,7 +1614,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1587,7 +1625,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1613,8 +1651,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1623,7 +1665,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1631,7 +1673,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1642,7 +1684,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1668,8 +1710,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1678,7 +1724,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1686,7 +1732,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py index 0d6a7148de..0131bf0b88 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,6 +81,7 @@ from .transports.grpc_asyncio import ExtensionRegistryServiceGrpcAsyncIOTransport from .transports.rest import ExtensionRegistryServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncExtensionRegistryServiceRestTransport @@ -137,7 +138,7 @@ class ExtensionRegistryServiceClient(metaclass=ExtensionRegistryServiceClientMet """A service for managing Vertex AI's Extension registry.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -145,7 +146,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -155,6 +156,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -508,7 +513,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -607,7 +612,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -709,7 +714,7 @@ def __init__( self._universe_domain = ExtensionRegistryServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1504,7 +1509,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1530,8 +1535,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1540,7 +1549,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1549,7 +1558,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1563,7 +1572,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1589,8 +1598,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1599,7 +1612,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1608,7 +1621,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1622,7 +1635,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1652,8 +1665,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1662,7 +1679,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1670,7 +1687,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1678,7 +1695,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1707,8 +1724,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1717,7 +1738,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1725,7 +1746,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1733,7 +1754,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1765,8 +1786,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1775,7 +1800,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1784,7 +1809,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1798,7 +1823,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1890,8 +1915,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1900,7 +1929,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1909,7 +1940,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1923,7 +1954,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2016,8 +2047,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2026,7 +2061,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2035,7 +2072,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2049,7 +2086,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2080,8 +2117,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2090,7 +2131,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2099,7 +2142,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2113,7 +2156,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2139,8 +2182,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2149,7 +2196,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2158,7 +2205,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2172,7 +2219,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2198,8 +2245,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2208,7 +2259,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2217,7 +2268,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py index 7f9215b457..c4f00f2894 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/README.rst index fa6fdda727..251bf7e7d4 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ExtensionRegistryServiceTransport` is the ABC for all transports. -- public child `ExtensionRegistryServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ExtensionRegistryServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseExtensionRegistryServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ExtensionRegistryServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ExtensionRegistryServiceTransport`` is the ABC for all transports. + +- public child ``ExtensionRegistryServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ExtensionRegistryServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseExtensionRegistryServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ExtensionRegistryServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/__init__.py index 8fc39eb219..9980bd05b4 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/base.py index d434440c20..e90e1b477a 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py index 3dacc53662..40ede35183 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py index 365a0a54dc..4a68037d09 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py index fc2d71bb6c..b7c15af63c 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -687,6 +687,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ExtensionRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1088,6 +1094,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1490,6 +1500,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1940,6 +1954,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2386,6 +2404,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2832,6 +2854,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py index 0814c913e7..1e1f915c4c 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -692,6 +692,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncExtensionRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1981,6 +1983,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2383,6 +2389,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2833,6 +2843,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3279,6 +3293,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3725,6 +3743,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py index 59db4ab89e..58b1d25cfd 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1081,6 +1081,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1502,6 +1506,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1971,6 +1979,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2436,6 +2448,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2901,6 +2917,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/__init__.py index 73ae18693f..efdeb2be1a 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py index f05833022b..c87cf7e1bf 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ def transport(self) -> FeatureOnlineStoreAdminServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -401,11 +401,11 @@ async def sample_create_feature_online_store(): ) # Make the request - operation = client.create_feature_online_store(request=request) + operation = await client.create_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -828,11 +828,11 @@ async def sample_update_feature_online_store(): ) # Make the request - operation = client.update_feature_online_store(request=request) + operation = await client.update_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -993,11 +993,11 @@ async def sample_delete_feature_online_store(): ) # Make the request - operation = client.delete_feature_online_store(request=request) + operation = await client.delete_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1156,11 +1156,11 @@ async def sample_create_feature_view(): ) # Make the request - operation = client.create_feature_view(request=request) + operation = await client.create_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1565,11 +1565,11 @@ async def sample_update_feature_view(): ) # Make the request - operation = client.update_feature_view(request=request) + operation = await client.update_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1726,11 +1726,11 @@ async def sample_delete_feature_view(): ) # Make the request - operation = client.delete_feature_view(request=request) + operation = await client.delete_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2204,7 +2204,7 @@ async def sample_list_feature_view_syncs(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2230,8 +2230,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2240,7 +2244,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2248,7 +2252,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2259,7 +2263,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2285,8 +2289,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2295,7 +2303,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2303,7 +2311,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2314,7 +2322,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2344,8 +2352,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2354,7 +2366,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2362,7 +2374,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2370,7 +2382,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2399,8 +2411,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2409,7 +2425,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2417,7 +2433,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2425,7 +2441,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2457,8 +2473,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2467,7 +2487,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2475,7 +2495,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2486,7 +2506,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2578,8 +2598,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2588,7 +2612,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2596,7 +2622,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2607,7 +2633,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2700,8 +2726,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2710,7 +2740,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2718,7 +2750,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2729,7 +2761,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2760,8 +2792,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2772,7 +2808,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2780,7 +2818,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2791,7 +2829,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2817,8 +2855,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2827,7 +2869,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2835,7 +2877,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2846,7 +2888,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2872,8 +2914,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2882,7 +2928,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2890,7 +2936,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py index afdc285aa6..f785dbe3ab 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,7 @@ from .transports.grpc_asyncio import FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport from .transports.rest import FeatureOnlineStoreAdminServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncFeatureOnlineStoreAdminServiceRestTransport, @@ -159,7 +160,7 @@ class FeatureOnlineStoreAdminServiceClient( """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -167,7 +168,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -177,6 +178,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -536,7 +541,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -635,7 +640,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -739,7 +744,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2702,7 +2707,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2728,8 +2733,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2738,7 +2747,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2747,7 +2756,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2761,7 +2770,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2787,8 +2796,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2797,7 +2810,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2806,7 +2819,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2820,7 +2833,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2850,8 +2863,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2860,7 +2877,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2868,7 +2885,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2876,7 +2893,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2905,8 +2922,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2915,7 +2936,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2923,7 +2944,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2931,7 +2952,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2963,8 +2984,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2973,7 +2998,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2982,7 +3007,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2996,7 +3021,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3088,8 +3113,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3098,7 +3127,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3107,7 +3138,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3121,7 +3152,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3214,8 +3245,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3224,7 +3259,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3233,7 +3270,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3247,7 +3284,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3278,8 +3315,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3288,7 +3329,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3297,7 +3340,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3311,7 +3354,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3337,8 +3380,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3347,7 +3394,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3356,7 +3403,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3370,7 +3417,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3396,8 +3443,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3406,7 +3457,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3415,7 +3466,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py index c4d19bff30..a392968d28 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/README.rst index 5cba49b63f..083e19db6d 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureOnlineStoreAdminServiceTransport` is the ABC for all transports. -- public child `FeatureOnlineStoreAdminServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureOnlineStoreAdminServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureOnlineStoreAdminServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureOnlineStoreAdminServiceTransport`` is the ABC for all transports. + +- public child ``FeatureOnlineStoreAdminServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureOnlineStoreAdminServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureOnlineStoreAdminServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/__init__.py index 31e263b75e..f9e09b3e01 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/base.py index 780173ba00..31d3a46ec8 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py index 59baabee0f..1da69c0c10 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py index b901a53148..f36c9dd08c 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py index d34017ff41..3456ec68fd 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1163,6 +1163,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureOnlineStoreAdminServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1566,6 +1572,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1968,6 +1978,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2418,6 +2432,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2864,6 +2882,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3310,6 +3332,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py index dd20bd0e66..c406efbc42 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1166,6 +1166,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureOnlineStoreAdminServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -3837,6 +3839,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -4239,6 +4245,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4689,6 +4699,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -5135,6 +5149,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -5581,6 +5599,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py index 27d2b36be8..333ebc969d 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1530,6 +1530,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1951,6 +1955,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2420,6 +2428,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2885,6 +2897,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3350,6 +3366,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/__init__.py index 25a187e722..b0b57ddfcd 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py index 5f21c22d59..bbbe22f724 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -206,7 +206,7 @@ def transport(self) -> FeatureOnlineStoreServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -843,7 +843,7 @@ async def sample_generate_fetch_access_token(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -869,8 +869,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -879,7 +883,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -887,7 +891,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -898,7 +902,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -924,8 +928,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -934,7 +942,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -942,7 +950,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -953,7 +961,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -983,8 +991,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -993,7 +1005,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1001,7 +1013,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1009,7 +1021,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1038,8 +1050,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1048,7 +1064,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1056,7 +1072,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1064,7 +1080,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1096,8 +1112,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1106,7 +1126,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1114,7 +1134,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1125,7 +1145,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1217,8 +1237,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1227,7 +1251,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1235,7 +1261,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1246,7 +1272,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1339,8 +1365,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1349,7 +1379,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1357,7 +1389,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1368,7 +1400,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1399,8 +1431,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1411,7 +1447,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1419,7 +1457,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1430,7 +1468,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1456,8 +1494,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1466,7 +1508,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1474,7 +1516,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1485,7 +1527,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1511,8 +1553,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1521,7 +1567,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1529,7 +1575,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py index 7ddc783ecc..838d12b75e 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport from .transports.rest import FeatureOnlineStoreServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeatureOnlineStoreServiceRestTransport @@ -134,7 +135,7 @@ class FeatureOnlineStoreServiceClient(metaclass=FeatureOnlineStoreServiceClientM """A service for fetching feature values from the online store.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -142,7 +143,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -152,6 +153,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -461,7 +466,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -560,7 +565,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -662,7 +667,7 @@ def __init__( self._universe_domain = FeatureOnlineStoreServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1314,7 +1319,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1340,8 +1345,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1350,7 +1359,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1359,7 +1368,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1373,7 +1382,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1399,8 +1408,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1409,7 +1422,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1418,7 +1431,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1432,7 +1445,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1462,8 +1475,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1472,7 +1489,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1480,7 +1497,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1488,7 +1505,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1517,8 +1534,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1527,7 +1548,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1535,7 +1556,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1543,7 +1564,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1575,8 +1596,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1585,7 +1610,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1594,7 +1619,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1608,7 +1633,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1700,8 +1725,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1710,7 +1739,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1719,7 +1750,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1733,7 +1764,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1826,8 +1857,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1836,7 +1871,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1845,7 +1882,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1859,7 +1896,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1890,8 +1927,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1900,7 +1941,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1909,7 +1952,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1923,7 +1966,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1949,8 +1992,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1959,7 +2006,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1968,7 +2015,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1982,7 +2029,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2008,8 +2055,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2018,7 +2069,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2027,7 +2078,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/README.rst index d54aed4f93..52ce0e47e1 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureOnlineStoreServiceTransport` is the ABC for all transports. -- public child `FeatureOnlineStoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureOnlineStoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureOnlineStoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureOnlineStoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureOnlineStoreServiceTransport`` is the ABC for all transports. + +- public child ``FeatureOnlineStoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureOnlineStoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureOnlineStoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureOnlineStoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/__init__.py index 1d96784925..ed629bc991 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/base.py index 38c56d8ffc..067a40fa2f 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py index 98af948215..fd9b30fdc3 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -189,6 +189,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py index d1cf15d82f..1bf4f11eaa 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -240,6 +240,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py index 363d051d5d..de8572aaa7 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -580,6 +580,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureOnlineStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py index 1ce51ac579..2a3e2e42e5 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -580,6 +580,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureOnlineStoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py index d693f36e19..5d0e04aef6 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -992,6 +992,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1413,6 +1417,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1882,6 +1890,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2347,6 +2359,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2812,6 +2828,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/__init__.py index 6b1b86a740..1e7c2c35d8 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py index c7e4f6e227..bf2b71a9bc 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -231,7 +231,7 @@ def transport(self) -> FeatureRegistryServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -387,11 +387,11 @@ async def sample_create_feature_group(): ) # Make the request - operation = client.create_feature_group(request=request) + operation = await client.create_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -784,11 +784,11 @@ async def sample_update_feature_group(): ) # Make the request - operation = client.update_feature_group(request=request) + operation = await client.update_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -938,11 +938,11 @@ async def sample_delete_feature_group(): ) # Make the request - operation = client.delete_feature_group(request=request) + operation = await client.delete_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1088,11 +1088,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1254,11 +1254,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1649,11 +1649,11 @@ async def sample_update_feature(): ) # Make the request - operation = client.update_feature(request=request) + operation = await client.update_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1807,11 +1807,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1950,11 +1950,11 @@ async def sample_create_feature_monitor(): ) # Make the request - operation = client.create_feature_monitor(request=request) + operation = await client.create_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2344,11 +2344,11 @@ async def sample_update_feature_monitor(): ) # Make the request - operation = client.update_feature_monitor(request=request) + operation = await client.update_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2496,11 +2496,11 @@ async def sample_delete_feature_monitor(): ) # Make the request - operation = client.delete_feature_monitor(request=request) + operation = await client.delete_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2980,7 +2980,7 @@ async def sample_list_feature_monitor_jobs(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3006,8 +3006,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3016,7 +3020,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3024,7 +3028,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3035,7 +3039,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3061,8 +3065,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3071,7 +3079,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3079,7 +3087,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3090,7 +3098,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3120,8 +3128,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3130,7 +3142,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3138,7 +3150,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3146,7 +3158,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3175,8 +3187,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3185,7 +3201,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3193,7 +3209,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3201,7 +3217,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3233,8 +3249,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3243,7 +3263,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3251,7 +3271,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3262,7 +3282,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3354,8 +3374,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3364,7 +3388,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3372,7 +3398,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3383,7 +3409,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3476,8 +3502,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3486,7 +3516,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3494,7 +3526,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3505,7 +3537,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3536,8 +3568,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3548,7 +3584,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3556,7 +3594,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3567,7 +3605,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3593,8 +3631,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3603,7 +3645,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3611,7 +3653,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3622,7 +3664,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3648,8 +3690,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3658,7 +3704,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3666,7 +3712,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py index 80d552beac..cf814fd950 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,6 +92,7 @@ from .transports.grpc_asyncio import FeatureRegistryServiceGrpcAsyncIOTransport from .transports.rest import FeatureRegistryServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeatureRegistryServiceRestTransport @@ -150,7 +151,7 @@ class FeatureRegistryServiceClient(metaclass=FeatureRegistryServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -158,7 +159,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -168,6 +169,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -551,7 +556,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -650,7 +655,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -750,7 +755,7 @@ def __init__( self._universe_domain = FeatureRegistryServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3472,7 +3477,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3498,8 +3503,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3508,7 +3517,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3517,7 +3526,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3531,7 +3540,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3557,8 +3566,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3567,7 +3580,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3576,7 +3589,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3590,7 +3603,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3620,8 +3633,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3630,7 +3647,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3638,7 +3655,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3646,7 +3663,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3675,8 +3692,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3685,7 +3706,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3693,7 +3714,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3701,7 +3722,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3733,8 +3754,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3743,7 +3768,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3752,7 +3777,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3766,7 +3791,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3858,8 +3883,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3868,7 +3897,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3877,7 +3908,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3891,7 +3922,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3984,8 +4015,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3994,7 +4029,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4003,7 +4040,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4017,7 +4054,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4048,8 +4085,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4058,7 +4099,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4067,7 +4110,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4081,7 +4124,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4107,8 +4150,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4117,7 +4164,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4126,7 +4173,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4140,7 +4187,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4166,8 +4213,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4176,7 +4227,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4185,7 +4236,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py index 7919d3cf2d..348a6f38d6 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/README.rst index d621059883..4d01ea5b41 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeatureRegistryServiceTransport` is the ABC for all transports. -- public child `FeatureRegistryServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeatureRegistryServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeatureRegistryServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeatureRegistryServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeatureRegistryServiceTransport`` is the ABC for all transports. + +- public child ``FeatureRegistryServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeatureRegistryServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeatureRegistryServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeatureRegistryServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/__init__.py index f5ea1cd995..6ebfeef638 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/base.py index f1d35eab28..e66d503a82 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -94,6 +94,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -143,6 +147,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py index acff4223a6..0bf4d24a2b 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -199,6 +199,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py index 02f57ae0c0..af8e8fb754 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -109,7 +109,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -250,6 +250,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py index 04f5d5de82..bf4d7d0766 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1505,6 +1505,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeatureRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1906,6 +1912,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2308,6 +2318,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2758,6 +2772,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3204,6 +3222,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3650,6 +3672,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py index 527c8fc1f2..61b4ec6fd3 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1508,6 +1508,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeatureRegistryServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -5137,6 +5139,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -5539,6 +5545,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -5989,6 +5999,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6435,6 +6449,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -6881,6 +6899,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py index 5f3d839916..0064f5a023 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1821,6 +1821,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2242,6 +2246,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2711,6 +2719,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3176,6 +3188,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3641,6 +3657,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/__init__.py index 2b01888ee2..7aef979b68 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py index 9f7c8c9886..8e51d509d4 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -211,7 +211,7 @@ def transport(self) -> FeaturestoreOnlineServingServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -730,7 +730,7 @@ async def sample_write_feature_values(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -756,8 +756,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -766,7 +770,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -774,7 +778,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -785,7 +789,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -811,8 +815,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -821,7 +829,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -829,7 +837,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -840,7 +848,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -870,8 +878,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -880,7 +892,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -888,7 +900,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -896,7 +908,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -925,8 +937,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -935,7 +951,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -943,7 +959,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -951,7 +967,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -983,8 +999,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -993,7 +1013,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1001,7 +1021,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1012,7 +1032,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1104,8 +1124,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1114,7 +1138,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1122,7 +1148,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1133,7 +1159,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1226,8 +1252,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1236,7 +1266,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1244,7 +1276,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1255,7 +1287,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1286,8 +1318,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1298,7 +1334,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1306,7 +1344,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1317,7 +1355,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1343,8 +1381,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1353,7 +1395,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1361,7 +1403,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1372,7 +1414,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1398,8 +1440,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1408,7 +1454,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1416,7 +1462,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py index 7a48c344c7..a78af0494b 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ ) from .transports.rest import FeaturestoreOnlineServingServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncFeaturestoreOnlineServingServiceRestTransport, @@ -141,7 +142,7 @@ class FeaturestoreOnlineServingServiceClient( """A service for serving online feature values.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -472,7 +477,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -569,7 +574,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -673,7 +678,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1213,7 +1218,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1239,8 +1244,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1249,7 +1258,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1258,7 +1267,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1272,7 +1281,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1298,8 +1307,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1308,7 +1321,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1317,7 +1330,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1331,7 +1344,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1361,8 +1374,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1371,7 +1388,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1379,7 +1396,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1387,7 +1404,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1416,8 +1433,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1426,7 +1447,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1434,7 +1455,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1442,7 +1463,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1474,8 +1495,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1484,7 +1509,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1493,7 +1518,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1507,7 +1532,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1599,8 +1624,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1609,7 +1638,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1618,7 +1649,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1632,7 +1663,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1725,8 +1756,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1735,7 +1770,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1744,7 +1781,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1758,7 +1795,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1789,8 +1826,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1799,7 +1840,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1808,7 +1851,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1822,7 +1865,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1848,8 +1891,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1858,7 +1905,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1867,7 +1914,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1881,7 +1928,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1907,8 +1954,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1917,7 +1968,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1926,7 +1977,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/README.rst index 5399789b7c..63c1c8959d 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeaturestoreOnlineServingServiceTransport` is the ABC for all transports. -- public child `FeaturestoreOnlineServingServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeaturestoreOnlineServingServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeaturestoreOnlineServingServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeaturestoreOnlineServingServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeaturestoreOnlineServingServiceTransport`` is the ABC for all transports. + +- public child ``FeaturestoreOnlineServingServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeaturestoreOnlineServingServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeaturestoreOnlineServingServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeaturestoreOnlineServingServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/__init__.py index c2b0c85800..9430909d8a 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/base.py index a047903c9b..af4c2d2aa4 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py index 556823dd46..10a5159dc0 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py index a6ce485dfe..da50ba1027 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py index 69e96a92b5..8c0290a0ec 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -579,6 +579,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeaturestoreOnlineServingServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py index 59f939e5a9..74460409d4 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -582,6 +582,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeaturestoreOnlineServingServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py index 80135a4aae..c2686b4fe3 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1003,6 +1003,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1424,6 +1428,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1893,6 +1901,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2358,6 +2370,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2823,6 +2839,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/__init__.py index c709802e45..aec58ce7aa 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py index d5c6cc2fff..31971b1635 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -215,7 +215,7 @@ def transport(self) -> FeaturestoreServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -367,11 +367,11 @@ async def sample_create_featurestore(): ) # Make the request - operation = client.create_featurestore(request=request) + operation = await client.create_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -766,11 +766,11 @@ async def sample_update_featurestore(): ) # Make the request - operation = client.update_featurestore(request=request) + operation = await client.update_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -923,11 +923,11 @@ async def sample_delete_featurestore(): ) # Make the request - operation = client.delete_featurestore(request=request) + operation = await client.delete_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1074,11 +1074,11 @@ async def sample_create_entity_type(): ) # Make the request - operation = client.create_entity_type(request=request) + operation = await client.create_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1624,11 +1624,11 @@ async def sample_delete_entity_type(): ) # Make the request - operation = client.delete_entity_type(request=request) + operation = await client.delete_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1774,11 +1774,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1940,11 +1940,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2479,11 +2479,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2651,11 +2651,11 @@ async def sample_import_feature_values(): ) # Make the request - operation = client.import_feature_values(request=request) + operation = await client.import_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2801,11 +2801,11 @@ async def sample_batch_read_feature_values(): ) # Make the request - operation = client.batch_read_feature_values(request=request) + operation = await client.batch_read_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2940,11 +2940,11 @@ async def sample_export_feature_values(): ) # Make the request - operation = client.export_feature_values(request=request) + operation = await client.export_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3086,11 +3086,11 @@ async def sample_delete_feature_values(): ) # Make the request - operation = client.delete_feature_values(request=request) + operation = await client.delete_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3393,7 +3393,7 @@ async def sample_search_features(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3419,8 +3419,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3429,7 +3433,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3437,7 +3441,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3448,7 +3452,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3474,8 +3478,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3484,7 +3492,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3492,7 +3500,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3503,7 +3511,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3533,8 +3541,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3543,7 +3555,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3551,7 +3563,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3559,7 +3571,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3588,8 +3600,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3598,7 +3614,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3606,7 +3622,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3614,7 +3630,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3646,8 +3662,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3656,7 +3676,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3664,7 +3684,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3675,7 +3695,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3767,8 +3787,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3777,7 +3801,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3785,7 +3811,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3796,7 +3822,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3889,8 +3915,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3899,7 +3929,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3907,7 +3939,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3918,7 +3950,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3949,8 +3981,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3961,7 +3997,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3969,7 +4007,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3980,7 +4018,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4006,8 +4044,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4016,7 +4058,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4024,7 +4066,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4035,7 +4077,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4061,8 +4103,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4071,7 +4117,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4079,7 +4125,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py index 186e2ad9d5..230089c917 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,7 @@ from .transports.grpc_asyncio import FeaturestoreServiceGrpcAsyncIOTransport from .transports.rest import FeaturestoreServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncFeaturestoreServiceRestTransport @@ -146,7 +147,7 @@ class FeaturestoreServiceClient(metaclass=FeaturestoreServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -154,7 +155,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -164,6 +165,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -521,7 +526,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -618,7 +623,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -718,7 +723,7 @@ def __init__( self._universe_domain = FeaturestoreServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3861,7 +3866,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3887,8 +3892,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3897,7 +3906,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3906,7 +3915,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3920,7 +3929,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3946,8 +3955,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3956,7 +3969,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3965,7 +3978,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3979,7 +3992,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4009,8 +4022,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4019,7 +4036,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4027,7 +4044,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4035,7 +4052,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4064,8 +4081,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4074,7 +4095,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4082,7 +4103,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4090,7 +4111,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4122,8 +4143,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4132,7 +4157,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4141,7 +4166,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4155,7 +4180,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4247,8 +4272,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4257,7 +4286,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4266,7 +4297,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4280,7 +4311,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4373,8 +4404,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4383,7 +4418,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4392,7 +4429,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4406,7 +4443,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4437,8 +4474,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4447,7 +4488,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4456,7 +4499,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4470,7 +4513,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4496,8 +4539,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4506,7 +4553,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4515,7 +4562,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4529,7 +4576,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4555,8 +4602,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4565,7 +4616,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4574,7 +4625,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py index e41e3fd9b2..a6c3cae2fd 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/README.rst index ec2e5d8e6e..1b9f16dc30 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`FeaturestoreServiceTransport` is the ABC for all transports. -- public child `FeaturestoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `FeaturestoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseFeaturestoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `FeaturestoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``FeaturestoreServiceTransport`` is the ABC for all transports. + +- public child ``FeaturestoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``FeaturestoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseFeaturestoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``FeaturestoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/__init__.py index 81505467c8..d2dfb5dd6f 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/base.py index 774345292d..53b791568b 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py index 0d8c2e56a5..bfa0725551 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py index 5c0465bc18..330c97bd13 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py index e04f16c32b..ee7d516831 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1609,6 +1609,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[FeaturestoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2010,6 +2016,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2412,6 +2422,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2862,6 +2876,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3308,6 +3326,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3754,6 +3776,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py index 171ae9193d..fd46695b26 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1612,6 +1612,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncFeaturestoreServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -5590,6 +5592,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -5992,6 +5998,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6442,6 +6452,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6888,6 +6902,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -7334,6 +7352,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py index e03521838f..1b30dafaa6 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1930,6 +1930,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2351,6 +2355,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2820,6 +2828,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3285,6 +3297,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3750,6 +3766,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/__init__.py index e99930ebf4..c51aa9d5dc 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py index fb55b8b32c..89f778e828 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -201,7 +201,7 @@ def transport(self) -> GenAiCacheServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -911,7 +911,7 @@ async def sample_list_cached_contents(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -937,8 +937,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -947,7 +951,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -955,7 +959,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -966,7 +970,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -992,8 +996,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1002,7 +1010,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1010,7 +1018,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1021,7 +1029,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1051,8 +1059,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1061,7 +1073,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1069,7 +1081,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1077,7 +1089,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1106,8 +1118,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1116,7 +1132,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1124,7 +1140,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1132,7 +1148,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1164,8 +1180,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1174,7 +1194,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1182,7 +1202,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1193,7 +1213,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1285,8 +1305,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1295,7 +1319,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1303,7 +1329,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1314,7 +1340,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1407,8 +1433,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1417,7 +1447,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1425,7 +1457,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1436,7 +1468,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1467,8 +1499,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1479,7 +1515,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1487,7 +1525,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1498,7 +1536,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1524,8 +1562,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1534,7 +1576,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1542,7 +1584,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1553,7 +1595,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1579,8 +1621,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1589,7 +1635,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1597,7 +1643,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py index 1cfa4f94a6..2f7fefcc03 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import GenAiCacheServiceGrpcAsyncIOTransport from .transports.rest import GenAiCacheServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncGenAiCacheServiceRestTransport @@ -136,7 +137,7 @@ class GenAiCacheServiceClient(metaclass=GenAiCacheServiceClientMeta): """Service for managing Vertex AI's CachedContent resource.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -483,7 +488,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -580,7 +585,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -680,7 +685,7 @@ def __init__( self._universe_domain = GenAiCacheServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1401,7 +1406,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1427,8 +1432,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1437,7 +1446,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1446,7 +1455,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1460,7 +1469,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1486,8 +1495,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1496,7 +1509,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1505,7 +1518,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1519,7 +1532,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1549,8 +1562,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1559,7 +1576,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1567,7 +1584,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1575,7 +1592,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1604,8 +1621,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1614,7 +1635,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1622,7 +1643,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1630,7 +1651,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1662,8 +1683,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1672,7 +1697,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1681,7 +1706,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1695,7 +1720,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1787,8 +1812,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1797,7 +1826,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1806,7 +1837,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1820,7 +1851,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1913,8 +1944,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1923,7 +1958,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1932,7 +1969,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1946,7 +1983,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1977,8 +2014,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1987,7 +2028,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1996,7 +2039,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2010,7 +2053,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2036,8 +2079,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2046,7 +2093,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2055,7 +2102,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2069,7 +2116,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2095,8 +2142,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2105,7 +2156,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2114,7 +2165,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py index 9477e69a93..b2d68fee20 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/README.rst index 22c94081d3..bda2b5ae08 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`GenAiCacheServiceTransport` is the ABC for all transports. -- public child `GenAiCacheServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `GenAiCacheServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseGenAiCacheServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `GenAiCacheServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``GenAiCacheServiceTransport`` is the ABC for all transports. + +- public child ``GenAiCacheServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``GenAiCacheServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseGenAiCacheServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``GenAiCacheServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/__init__.py index 13ea33cff7..74b98dba41 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/base.py index c084c9c1ca..754a484117 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py index da83ea0d0d..285561c81c 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py index e98dd58dab..43a8e1a50b 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py index c5530d801f..eeb15a0da9 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -655,6 +655,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[GenAiCacheServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py index 84948642d2..217cdeecfc 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -655,6 +655,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncGenAiCacheServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py index d6e976462e..6bb130cdf8 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1082,6 +1082,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1503,6 +1507,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1972,6 +1980,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2437,6 +2449,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2902,6 +2918,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/__init__.py index 5ce83d83aa..b143b04833 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py index b4e425a7ee..a6d4305387 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> GenAiTuningServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -844,11 +844,11 @@ async def sample_rebase_tuned_model(): ) # Make the request - operation = client.rebase_tuned_model(request=request) + operation = await client.rebase_tuned_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -951,7 +951,7 @@ async def sample_rebase_tuned_model(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -977,8 +977,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -987,7 +991,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -995,7 +999,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1006,7 +1010,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1032,8 +1036,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1042,7 +1050,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1050,7 +1058,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1061,7 +1069,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1091,8 +1099,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1101,7 +1113,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1109,7 +1121,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1117,7 +1129,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1146,8 +1158,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1156,7 +1172,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1164,7 +1180,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1172,7 +1188,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1204,8 +1220,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1214,7 +1234,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1222,7 +1242,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1233,7 +1253,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1325,8 +1345,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1335,7 +1359,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1343,7 +1369,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1354,7 +1380,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1447,8 +1473,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1457,7 +1487,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1465,7 +1497,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1476,7 +1508,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1507,8 +1539,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1519,7 +1555,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1527,7 +1565,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1538,7 +1576,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1564,8 +1602,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1574,7 +1616,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1582,7 +1624,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1593,7 +1635,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1619,8 +1661,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1629,7 +1675,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1637,7 +1683,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py index cd2c252f29..33ebb2a0b8 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import GenAiTuningServiceGrpcAsyncIOTransport from .transports.rest import GenAiTuningServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncGenAiTuningServiceRestTransport @@ -136,7 +137,7 @@ class GenAiTuningServiceClient(metaclass=GenAiTuningServiceClientMeta): """A service for creating and managing GenAI Tuning Jobs.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -551,7 +556,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -648,7 +653,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -748,7 +753,7 @@ def __init__( self._universe_domain = GenAiTuningServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1503,7 +1508,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1529,8 +1534,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1539,7 +1548,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1548,7 +1557,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1562,7 +1571,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1588,8 +1597,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1598,7 +1611,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1607,7 +1620,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1621,7 +1634,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1651,8 +1664,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1661,7 +1678,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1669,7 +1686,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1677,7 +1694,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1706,8 +1723,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1716,7 +1737,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1724,7 +1745,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1732,7 +1753,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1764,8 +1785,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1774,7 +1799,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1783,7 +1808,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1797,7 +1822,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1889,8 +1914,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1899,7 +1928,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1908,7 +1939,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1922,7 +1953,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2015,8 +2046,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2025,7 +2060,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2034,7 +2071,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2048,7 +2085,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2079,8 +2116,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2089,7 +2130,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2098,7 +2141,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2112,7 +2155,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2138,8 +2181,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2148,7 +2195,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2157,7 +2204,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2171,7 +2218,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2197,8 +2244,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2207,7 +2258,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2216,7 +2267,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py index 0a14075295..3d53fa5faa 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/README.rst index 66b7511385..abd0af88e9 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`GenAiTuningServiceTransport` is the ABC for all transports. -- public child `GenAiTuningServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `GenAiTuningServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseGenAiTuningServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `GenAiTuningServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``GenAiTuningServiceTransport`` is the ABC for all transports. + +- public child ``GenAiTuningServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``GenAiTuningServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseGenAiTuningServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``GenAiTuningServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/__init__.py index a24ba52e16..3b91dbf3c2 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/base.py index 55631255f2..7d64d8acbc 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py index 2be0d2b051..fa0e93ee12 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py index 05405ab7f3..84895adc0b 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py index da7ffaa119..fd34d98853 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -652,6 +652,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[GenAiTuningServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1053,6 +1059,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1455,6 +1465,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1905,6 +1919,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2351,6 +2369,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2797,6 +2819,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py index ba28b1c88f..eee426f287 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -653,6 +653,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncGenAiTuningServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1903,6 +1905,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2305,6 +2311,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2755,6 +2765,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3201,6 +3215,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3647,6 +3665,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py index d9638b3461..89529cf6d1 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1090,6 +1090,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1511,6 +1515,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1980,6 +1988,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2445,6 +2457,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2910,6 +2926,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/__init__.py index 0cde92313e..87ec9b5193 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py index 00b1f45475..fecd6bb071 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> IndexEndpointServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -360,11 +360,11 @@ async def sample_create_index_endpoint(): ) # Make the request - operation = client.create_index_endpoint(request=request) + operation = await client.create_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -870,11 +870,11 @@ async def sample_delete_index_endpoint(): ) # Make the request - operation = client.delete_index_endpoint(request=request) + operation = await client.delete_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1014,11 +1014,11 @@ async def sample_deploy_index(): ) # Make the request - operation = client.deploy_index(request=request) + operation = await client.deploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1157,11 +1157,11 @@ async def sample_undeploy_index(): ) # Make the request - operation = client.undeploy_index(request=request) + operation = await client.undeploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1303,11 +1303,11 @@ async def sample_mutate_deployed_index(): ) # Make the request - operation = client.mutate_deployed_index(request=request) + operation = await client.mutate_deployed_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1412,7 +1412,7 @@ async def sample_mutate_deployed_index(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1438,8 +1438,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1448,7 +1452,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1456,7 +1460,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1467,7 +1471,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1493,8 +1497,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1503,7 +1511,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1511,7 +1519,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1522,7 +1530,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1552,8 +1560,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1562,7 +1574,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1570,7 +1582,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1578,7 +1590,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1607,8 +1619,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1617,7 +1633,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1625,7 +1641,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1633,7 +1649,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1665,8 +1681,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1675,7 +1695,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1683,7 +1703,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1694,7 +1714,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1786,8 +1806,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1796,7 +1820,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1804,7 +1830,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1815,7 +1841,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1908,8 +1934,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1918,7 +1948,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1926,7 +1958,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1937,7 +1969,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1968,8 +2000,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1980,7 +2016,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1988,7 +2026,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1999,7 +2037,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2025,8 +2063,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2035,7 +2077,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2043,7 +2085,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2054,7 +2096,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2080,8 +2122,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2090,7 +2136,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2098,7 +2144,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py index 8eb93f157d..3c487b0fb9 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import IndexEndpointServiceGrpcAsyncIOTransport from .transports.rest import IndexEndpointServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncIndexEndpointServiceRestTransport @@ -138,7 +139,7 @@ class IndexEndpointServiceClient(metaclass=IndexEndpointServiceClientMeta): """A service for managing Vertex AI's IndexEndpoints.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -507,7 +512,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -604,7 +609,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -704,7 +709,7 @@ def __init__( self._universe_domain = IndexEndpointServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1911,7 +1916,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1937,8 +1942,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1947,7 +1956,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1956,7 +1965,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1970,7 +1979,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1996,8 +2005,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2006,7 +2019,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2015,7 +2028,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2029,7 +2042,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2059,8 +2072,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2069,7 +2086,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2077,7 +2094,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2085,7 +2102,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2114,8 +2131,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2124,7 +2145,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2132,7 +2153,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2140,7 +2161,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2172,8 +2193,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2182,7 +2207,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2191,7 +2216,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2205,7 +2230,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2297,8 +2322,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2307,7 +2336,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2316,7 +2347,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2330,7 +2361,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2423,8 +2454,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2433,7 +2468,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2442,7 +2479,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2456,7 +2493,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2487,8 +2524,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2497,7 +2538,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2506,7 +2549,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2520,7 +2563,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2546,8 +2589,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2556,7 +2603,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2565,7 +2612,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2579,7 +2626,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2605,8 +2652,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2615,7 +2666,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2624,7 +2675,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py index 1f6ad50b97..47bbfe7725 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/README.rst index e52ec8d550..dedeae855f 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`IndexEndpointServiceTransport` is the ABC for all transports. -- public child `IndexEndpointServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `IndexEndpointServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseIndexEndpointServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `IndexEndpointServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``IndexEndpointServiceTransport`` is the ABC for all transports. + +- public child ``IndexEndpointServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``IndexEndpointServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseIndexEndpointServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``IndexEndpointServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__init__.py index 9026c2c90d..7e4c26dd88 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/base.py index ebd4b26002..c77d6d9309 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py index 65615a3847..ae2b7b2891 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py index 5214df3c56..71be17a763 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py index 11616084ef..3072f8a6da 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -862,6 +862,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[IndexEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1263,6 +1269,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1665,6 +1675,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2115,6 +2129,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2561,6 +2579,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3007,6 +3029,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py index 0c17171219..4adbd16b6f 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -863,6 +863,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncIndexEndpointServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2661,6 +2663,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3063,6 +3069,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3513,6 +3523,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3959,6 +3973,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4405,6 +4423,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py index 9f575e43fa..b43f2a9e55 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1252,6 +1252,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1673,6 +1677,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2142,6 +2150,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2607,6 +2619,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3072,6 +3088,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/index_service/__init__.py index e9750e7565..e788091445 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py index 1093f8a977..7e3867681c 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ def transport(self) -> IndexServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -349,11 +349,11 @@ async def sample_create_index(): ) # Make the request - operation = client.create_index(request=request) + operation = await client.create_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -602,11 +602,11 @@ async def sample_import_index(): ) # Make the request - operation = client.import_index(request=request) + operation = await client.import_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -835,11 +835,11 @@ async def sample_update_index(): ) # Make the request - operation = client.update_index(request=request) + operation = await client.update_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -975,11 +975,11 @@ async def sample_delete_index(): ) # Make the request - operation = client.delete_index(request=request) + operation = await client.delete_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1251,7 +1251,7 @@ async def sample_remove_datapoints(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1277,8 +1277,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1287,7 +1291,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1295,7 +1299,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1306,7 +1310,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1332,8 +1336,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1342,7 +1350,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1350,7 +1358,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1361,7 +1369,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1391,8 +1399,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1401,7 +1413,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1409,7 +1421,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1417,7 +1429,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1446,8 +1458,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1456,7 +1472,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1464,7 +1480,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1472,7 +1488,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1504,8 +1520,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1514,7 +1534,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1522,7 +1542,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1533,7 +1553,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1625,8 +1645,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1635,7 +1659,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1643,7 +1669,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1680,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1747,8 +1773,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1757,7 +1787,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1765,7 +1797,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1776,7 +1808,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1807,8 +1839,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1819,7 +1855,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1827,7 +1865,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1838,7 +1876,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1864,8 +1902,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1874,7 +1916,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1882,7 +1924,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1893,7 +1935,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1919,8 +1961,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1929,7 +1975,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1937,7 +1983,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/client.py b/google/cloud/aiplatform_v1beta1/services/index_service/client.py index 70ba5a8536..cf8e40420a 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ from .transports.grpc_asyncio import IndexServiceGrpcAsyncIOTransport from .transports.rest import IndexServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncIndexServiceRestTransport @@ -139,7 +140,7 @@ class IndexServiceClient(metaclass=IndexServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -147,7 +148,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -157,6 +158,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -486,7 +491,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -583,7 +588,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -679,7 +684,7 @@ def __init__( self._universe_domain = IndexServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1733,7 +1738,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1759,8 +1764,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1769,7 +1778,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1778,7 +1787,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1792,7 +1801,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1818,8 +1827,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1828,7 +1841,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1837,7 +1850,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1851,7 +1864,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1881,8 +1894,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1891,7 +1908,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1899,7 +1916,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1907,7 +1924,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1936,8 +1953,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1946,7 +1967,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1954,7 +1975,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1962,7 +1983,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1994,8 +2015,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2004,7 +2029,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2013,7 +2038,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2027,7 +2052,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2119,8 +2144,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2129,7 +2158,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2138,7 +2169,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2152,7 +2183,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2245,8 +2276,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2255,7 +2290,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2264,7 +2301,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2278,7 +2315,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2309,8 +2346,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2319,7 +2360,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2328,7 +2371,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2342,7 +2385,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2368,8 +2411,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2378,7 +2425,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2387,7 +2434,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2401,7 +2448,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2427,8 +2474,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2437,7 +2488,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2446,7 +2497,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py index 721960bcd0..e590c45aa1 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/index_service/transports/README.rst index 7b077a4f65..ab6e98844e 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`IndexServiceTransport` is the ABC for all transports. -- public child `IndexServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `IndexServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseIndexServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `IndexServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``IndexServiceTransport`` is the ABC for all transports. + +- public child ``IndexServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``IndexServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseIndexServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``IndexServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/__init__.py index 7e67aeafd7..ad680c5ec1 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py index 8dfdf7690d..6e36edcd11 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py index 53f59eb52d..f88ebf09f0 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py index 43b9cfb4dd..3eacac9db8 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py index 2b49d38a65..0de3f8608b 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -849,6 +849,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[IndexServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1250,6 +1256,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1652,6 +1662,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2102,6 +2116,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2548,6 +2566,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2994,6 +3016,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py index cfa424a3cd..700a7512ca 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -850,6 +850,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncIndexServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2669,6 +2671,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3071,6 +3077,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3521,6 +3531,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3967,6 +3981,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4413,6 +4431,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py index f015c84c3a..4be67ceb2d 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1249,6 +1249,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1670,6 +1674,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2139,6 +2147,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2604,6 +2616,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3069,6 +3085,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py index 89e72b6794..bc3111e704 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py index 568a633ac1..195e9159ab 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -277,7 +277,7 @@ def transport(self) -> JobServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -795,11 +795,11 @@ async def sample_delete_custom_job(): ) # Make the request - operation = client.delete_custom_job(request=request) + operation = await client.delete_custom_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1409,11 +1409,11 @@ async def sample_delete_data_labeling_job(): ) # Make the request - operation = client.delete_data_labeling_job(request=request) + operation = await client.delete_data_labeling_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2030,11 +2030,11 @@ async def sample_delete_hyperparameter_tuning_job(): ) # Make the request - operation = client.delete_hyperparameter_tuning_job(request=request) + operation = await client.delete_hyperparameter_tuning_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2644,11 +2644,11 @@ async def sample_delete_nas_job(): ) # Make the request - operation = client.delete_nas_job(request=request) + operation = await client.delete_nas_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3518,11 +3518,11 @@ async def sample_delete_batch_prediction_job(): ) # Make the request - operation = client.delete_batch_prediction_job(request=request) + operation = await client.delete_batch_prediction_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4313,11 +4313,11 @@ async def sample_update_model_deployment_monitoring_job(): ) # Make the request - operation = client.update_model_deployment_monitoring_job(request=request) + operation = await client.update_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4485,11 +4485,11 @@ async def sample_delete_model_deployment_monitoring_job(): ) # Make the request - operation = client.delete_model_deployment_monitoring_job(request=request) + operation = await client.delete_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4804,7 +4804,7 @@ async def sample_resume_model_deployment_monitoring_job(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4830,8 +4830,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4840,7 +4844,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4848,7 +4852,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4859,7 +4863,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4885,8 +4889,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4895,7 +4903,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4903,7 +4911,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4914,7 +4922,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4944,8 +4952,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4954,7 +4966,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4962,7 +4974,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4970,7 +4982,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4999,8 +5011,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5009,7 +5025,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5017,7 +5033,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5025,7 +5041,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5057,8 +5073,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5067,7 +5087,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5075,7 +5095,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5086,7 +5106,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5178,8 +5198,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5188,7 +5212,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5196,7 +5222,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5207,7 +5233,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5300,8 +5326,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5310,7 +5340,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5318,7 +5350,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5329,7 +5361,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5360,8 +5392,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5372,7 +5408,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5380,7 +5418,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5391,7 +5429,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5417,8 +5455,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5427,7 +5469,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5435,7 +5477,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5446,7 +5488,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5472,8 +5514,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5482,7 +5528,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5490,7 +5536,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/client.py b/google/cloud/aiplatform_v1beta1/services/job_service/client.py index 1179ff6f66..f647a30572 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -112,6 +112,7 @@ from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport from .transports.rest import JobServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncJobServiceRestTransport @@ -166,7 +167,7 @@ class JobServiceClient(metaclass=JobServiceClientMeta): """A service for creating and managing Vertex AI's jobs.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -174,7 +175,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -184,6 +185,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -868,7 +873,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -965,7 +970,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -1061,7 +1066,7 @@ def __init__( self._universe_domain = JobServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -5549,7 +5554,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5575,8 +5580,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5585,7 +5594,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5594,7 +5603,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5608,7 +5617,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5634,8 +5643,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5644,7 +5657,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5653,7 +5666,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5667,7 +5680,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5697,8 +5710,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5707,7 +5724,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5715,7 +5732,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5723,7 +5740,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5752,8 +5769,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5762,7 +5783,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5770,7 +5791,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5778,7 +5799,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5810,8 +5831,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5820,7 +5845,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5829,7 +5854,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5843,7 +5868,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5935,8 +5960,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5945,7 +5974,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5954,7 +5985,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5968,7 +5999,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6061,8 +6092,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6071,7 +6106,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -6080,7 +6117,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6094,7 +6131,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6125,8 +6162,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6135,7 +6176,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -6144,7 +6187,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6158,7 +6201,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6184,8 +6227,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6194,7 +6241,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -6203,7 +6250,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -6217,7 +6264,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -6243,8 +6290,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -6253,7 +6304,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -6262,7 +6313,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py index d97cedd8f1..a2061e49d7 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/job_service/transports/README.rst index 1d056719ab..fe0800d742 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`JobServiceTransport` is the ABC for all transports. -- public child `JobServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `JobServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseJobServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `JobServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``JobServiceTransport`` is the ABC for all transports. + +- public child ``JobServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``JobServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseJobServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``JobServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py index 9c065db1e6..0c50c34207 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py index 63d1a0eea9..bd7fe2cfc0 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -110,6 +110,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -159,6 +163,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py index 0bac72d5e3..b21d7565e9 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -116,7 +116,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -211,6 +211,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py index a9d5e9d030..c90e14597f 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,7 +87,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -122,7 +122,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -262,6 +262,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py index e19f73c98a..91c2e1d75f 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2170,6 +2170,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[JobServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2571,6 +2577,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2973,6 +2983,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3423,6 +3437,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3869,6 +3887,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4315,6 +4337,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py index 07a46236ef..79207cc66f 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2173,6 +2173,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncJobServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -8338,6 +8340,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -8740,6 +8746,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -9190,6 +9200,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -9636,6 +9650,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -10082,6 +10100,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py index e74d28d8f5..f028b3abbc 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2656,6 +2656,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3077,6 +3081,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3546,6 +3554,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4011,6 +4023,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4476,6 +4492,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py index 794046854e..448ab7a18e 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py index 383da09490..3596252e2d 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -189,7 +189,7 @@ def transport(self) -> LlmUtilityServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -431,7 +431,7 @@ async def sample_compute_tokens(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -457,8 +457,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -467,7 +471,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -475,7 +479,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -486,7 +490,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -512,8 +516,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -522,7 +530,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -530,7 +538,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -541,7 +549,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -571,8 +579,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -581,7 +593,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -589,7 +601,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -597,7 +609,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -626,8 +638,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -636,7 +652,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -644,7 +660,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -652,7 +668,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -684,8 +700,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -694,7 +714,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -702,7 +722,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -713,7 +733,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -805,8 +825,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -815,7 +839,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -823,7 +849,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -834,7 +860,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -927,8 +953,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -937,7 +967,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -945,7 +977,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -956,7 +988,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -987,8 +1019,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -999,7 +1035,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1007,7 +1045,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1018,7 +1056,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1044,8 +1082,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1054,7 +1096,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1062,7 +1104,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1073,7 +1115,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1099,8 +1141,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1109,7 +1155,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1117,7 +1163,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py index 67431bea61..a5be227f8a 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport from .transports.rest import LlmUtilityServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncLlmUtilityServiceRestTransport @@ -128,7 +129,7 @@ class LlmUtilityServiceClient(metaclass=LlmUtilityServiceClientMeta): """Service for LLM related utility functions.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -136,7 +137,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -146,6 +147,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -453,7 +458,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -550,7 +555,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -650,7 +655,7 @@ def __init__( self._universe_domain = LlmUtilityServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -915,7 +920,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -941,8 +946,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -951,7 +960,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -960,7 +969,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -974,7 +983,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1000,8 +1009,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1010,7 +1023,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1019,7 +1032,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1033,7 +1046,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1063,8 +1076,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1073,7 +1090,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1081,7 +1098,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1089,7 +1106,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1118,8 +1135,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1128,7 +1149,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1136,7 +1157,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1144,7 +1165,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1176,8 +1197,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1186,7 +1211,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1195,7 +1220,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1209,7 +1234,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1301,8 +1326,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1311,7 +1340,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1320,7 +1351,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1334,7 +1365,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1427,8 +1458,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1437,7 +1472,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1446,7 +1483,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1460,7 +1497,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1491,8 +1528,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1501,7 +1542,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1510,7 +1553,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1524,7 +1567,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1550,8 +1593,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1560,7 +1607,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1569,7 +1616,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1583,7 +1630,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1609,8 +1656,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1619,7 +1670,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1628,7 +1679,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/README.rst index 83689fda90..d99c067f3e 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`LlmUtilityServiceTransport` is the ABC for all transports. -- public child `LlmUtilityServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `LlmUtilityServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseLlmUtilityServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `LlmUtilityServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``LlmUtilityServiceTransport`` is the ABC for all transports. + +- public child ``LlmUtilityServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``LlmUtilityServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseLlmUtilityServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``LlmUtilityServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py index b1dc8c19d3..e3034c1e7e 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py index 23c45dc44a..4561b8ab2f 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py index 24057f324d..36393bf015 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -189,6 +189,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py index 8180b4f919..ad2fa05167 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -240,6 +240,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py index a62268e678..b17e924bc5 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -458,6 +458,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[LlmUtilityServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py index 0d61b35066..e8287a9d53 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -458,6 +458,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncLlmUtilityServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py index 7656cd093b..16f1f48fc0 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -894,6 +894,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1315,6 +1319,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1784,6 +1792,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2249,6 +2261,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2714,6 +2730,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/match_service/__init__.py index 418b6338d1..6fc513a0e2 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py index 7f58f431a9..ee436241c9 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -189,7 +189,7 @@ def transport(self) -> MatchServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -480,7 +480,7 @@ async def sample_read_index_datapoints(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -506,8 +506,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -516,7 +520,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -524,7 +528,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -535,7 +539,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -561,8 +565,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -571,7 +579,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -579,7 +587,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -590,7 +598,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -620,8 +628,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -630,7 +642,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -638,7 +650,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -646,7 +658,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -675,8 +687,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -685,7 +701,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -693,7 +709,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -701,7 +717,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -733,8 +749,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -743,7 +763,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -751,7 +771,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -762,7 +782,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -854,8 +874,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -864,7 +888,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -872,7 +898,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -883,7 +909,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -976,8 +1002,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -986,7 +1016,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -994,7 +1026,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1005,7 +1037,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1036,8 +1068,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1048,7 +1084,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1056,7 +1094,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1067,7 +1105,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1093,8 +1131,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1103,7 +1145,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1111,7 +1153,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1122,7 +1164,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1148,8 +1190,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1158,7 +1204,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1166,7 +1212,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/client.py b/google/cloud/aiplatform_v1beta1/services/match_service/client.py index d9f11319d1..8d883efae0 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ from .transports.grpc_asyncio import MatchServiceGrpcAsyncIOTransport from .transports.rest import MatchServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMatchServiceRestTransport @@ -128,7 +129,7 @@ class MatchServiceClient(metaclass=MatchServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -136,7 +137,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -146,6 +147,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -453,7 +458,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -550,7 +555,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -646,7 +651,7 @@ def __init__( self._universe_domain = MatchServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -959,7 +964,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -985,8 +990,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -995,7 +1004,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1004,7 +1013,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1018,7 +1027,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1044,8 +1053,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1054,7 +1067,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1063,7 +1076,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1077,7 +1090,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1107,8 +1120,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1117,7 +1134,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1125,7 +1142,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1133,7 +1150,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1162,8 +1179,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1172,7 +1193,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1180,7 +1201,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1188,7 +1209,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1220,8 +1241,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1230,7 +1255,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1239,7 +1264,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1253,7 +1278,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1345,8 +1370,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1355,7 +1384,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1364,7 +1395,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1378,7 +1409,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1471,8 +1502,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1481,7 +1516,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1490,7 +1527,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1504,7 +1541,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1535,8 +1572,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1545,7 +1586,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1554,7 +1597,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1568,7 +1611,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1594,8 +1637,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1604,7 +1651,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1613,7 +1660,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1627,7 +1674,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1653,8 +1700,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1663,7 +1714,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1672,7 +1723,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/match_service/transports/README.rst index 51465d214e..2587227e2d 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MatchServiceTransport` is the ABC for all transports. -- public child `MatchServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MatchServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMatchServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MatchServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MatchServiceTransport`` is the ABC for all transports. + +- public child ``MatchServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MatchServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMatchServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MatchServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/__init__.py index ab63d1e630..aaf638bf25 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/base.py index 132a3aa9e1..d161f60d07 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -134,6 +138,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py index 8fddb5bdd1..adc7f11ab1 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -94,7 +94,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py index 116988aa8b..74f6ccd27f 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py index 725d7e7835..1421b2c6e1 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MatchServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py index 017248e04a..24dfeddd1b 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMatchServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py index c677db6ce6..f14c7ad72f 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -936,6 +936,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1357,6 +1361,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1826,6 +1834,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2291,6 +2303,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2756,6 +2772,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/__init__.py index 8cff551caf..294bca2940 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/async_client.py index ac244739d4..4fe66208e9 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ def transport(self) -> MemoryBankServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -354,11 +354,11 @@ async def sample_create_memory(): ) # Make the request - operation = client.create_memory(request=request) + operation = await client.create_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -617,11 +617,11 @@ async def sample_update_memory(): ) # Make the request - operation = client.update_memory(request=request) + operation = await client.update_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -887,11 +887,11 @@ async def sample_delete_memory(): ) # Make the request - operation = client.delete_memory(request=request) + operation = await client.delete_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1027,11 +1027,11 @@ async def sample_generate_memories(): ) # Make the request - operation = client.generate_memories(request=request) + operation = await client.generate_memories(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1241,7 +1241,7 @@ async def sample_retrieve_memories(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1267,8 +1267,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1277,7 +1281,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1285,7 +1289,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1296,7 +1300,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1322,8 +1326,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1332,7 +1340,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1340,7 +1348,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1351,7 +1359,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1381,8 +1389,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1391,7 +1403,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1399,7 +1411,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1407,7 +1419,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1436,8 +1448,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1446,7 +1462,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1454,7 +1470,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1462,7 +1478,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1494,8 +1510,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1504,7 +1524,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1512,7 +1532,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1523,7 +1543,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1615,8 +1635,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1625,7 +1649,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1633,7 +1659,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1644,7 +1670,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1737,8 +1763,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1747,7 +1777,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1755,7 +1787,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1766,7 +1798,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1797,8 +1829,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1809,7 +1845,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1817,7 +1855,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1828,7 +1866,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1854,8 +1892,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1864,7 +1906,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1872,7 +1914,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1883,7 +1925,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1909,8 +1951,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1919,7 +1965,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1927,7 +1973,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/client.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/client.py index e045aff30f..24072c40f1 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ from .transports.grpc_asyncio import MemoryBankServiceGrpcAsyncIOTransport from .transports.rest import MemoryBankServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMemoryBankServiceRestTransport @@ -135,7 +136,7 @@ class MemoryBankServiceClient(metaclass=MemoryBankServiceClientMeta): """A service for managing memories for LLM applications.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -143,7 +144,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -153,6 +154,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -508,7 +513,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -605,7 +610,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -705,7 +710,7 @@ def __init__( self._universe_domain = MemoryBankServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1749,7 +1754,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1775,8 +1780,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1785,7 +1794,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1794,7 +1803,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1808,7 +1817,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1834,8 +1843,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1844,7 +1857,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1853,7 +1866,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1867,7 +1880,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1897,8 +1910,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1907,7 +1924,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1915,7 +1932,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1923,7 +1940,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1952,8 +1969,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1962,7 +1983,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1970,7 +1991,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1978,7 +1999,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2010,8 +2031,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2020,7 +2045,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2029,7 +2054,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2043,7 +2068,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2135,8 +2160,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2145,7 +2174,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2154,7 +2185,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2168,7 +2199,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2261,8 +2292,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2271,7 +2306,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2280,7 +2317,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2294,7 +2331,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2325,8 +2362,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2335,7 +2376,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2344,7 +2387,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2358,7 +2401,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2384,8 +2427,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2394,7 +2441,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2403,7 +2450,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2417,7 +2464,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2443,8 +2490,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2453,7 +2504,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2462,7 +2513,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/pagers.py index 1019e21e57..a25d35e6e1 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/README.rst index 2ee0f27032..796c7d7f05 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MemoryBankServiceTransport` is the ABC for all transports. -- public child `MemoryBankServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MemoryBankServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMemoryBankServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MemoryBankServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MemoryBankServiceTransport`` is the ABC for all transports. + +- public child ``MemoryBankServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MemoryBankServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMemoryBankServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MemoryBankServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__init__.py index 8edca092c5..cba572fd16 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/base.py index c7eabb8616..0485f63cbe 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc.py index e8df9e2abd..c8660200c4 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc_asyncio.py index de32e303f5..148cff9d10 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest.py index 11ec09165f..1bbcc61a0b 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -798,6 +798,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MemoryBankServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1199,6 +1205,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1601,6 +1611,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2051,6 +2065,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2497,6 +2515,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2943,6 +2965,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_asyncio.py index 5cdbbcee62..8a56492431 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -799,6 +799,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMemoryBankServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2430,6 +2432,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2832,6 +2838,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3282,6 +3292,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3728,6 +3742,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4174,6 +4192,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_base.py index f36581afd4..01acae70d3 100644 --- a/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1224,6 +1224,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1645,6 +1649,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2114,6 +2122,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2579,6 +2591,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3044,6 +3060,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/__init__.py index 74e9509053..5e52ea7be7 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py index 402acf0864..602e994414 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ def transport(self) -> MetadataServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -370,11 +370,11 @@ async def sample_create_metadata_store(): ) # Make the request - operation = client.create_metadata_store(request=request) + operation = await client.create_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -767,11 +767,11 @@ async def sample_delete_metadata_store(): ) # Make the request - operation = client.delete_metadata_store(request=request) + operation = await client.delete_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1398,11 +1398,11 @@ async def sample_delete_artifact(): ) # Make the request - operation = client.delete_artifact(request=request) + operation = await client.delete_artifact(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1533,11 +1533,11 @@ async def sample_purge_artifacts(): ) # Make the request - operation = client.purge_artifacts(request=request) + operation = await client.purge_artifacts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2155,11 +2155,11 @@ async def sample_delete_context(): ) # Make the request - operation = client.delete_context(request=request) + operation = await client.delete_context(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2290,11 +2290,11 @@ async def sample_purge_contexts(): ) # Make the request - operation = client.purge_contexts(request=request) + operation = await client.purge_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3436,11 +3436,11 @@ async def sample_delete_execution(): ) # Make the request - operation = client.delete_execution(request=request) + operation = await client.delete_execution(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3571,11 +3571,11 @@ async def sample_purge_executions(): ) # Make the request - operation = client.purge_executions(request=request) + operation = await client.purge_executions(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4427,7 +4427,7 @@ async def sample_query_artifact_lineage_subgraph(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4453,8 +4453,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4463,7 +4467,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4471,7 +4475,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4482,7 +4486,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4508,8 +4512,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4518,7 +4526,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4526,7 +4534,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4537,7 +4545,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4567,8 +4575,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4577,7 +4589,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4585,7 +4597,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4593,7 +4605,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4622,8 +4634,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4632,7 +4648,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4640,7 +4656,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4648,7 +4664,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4680,8 +4696,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4690,7 +4710,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4698,7 +4718,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4709,7 +4729,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4801,8 +4821,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4811,7 +4835,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4819,7 +4845,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4830,7 +4856,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4923,8 +4949,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4933,7 +4963,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4941,7 +4973,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4952,7 +4984,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4983,8 +5015,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4995,7 +5031,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5003,7 +5041,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5014,7 +5052,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5040,8 +5078,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5050,7 +5092,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5058,7 +5100,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5069,7 +5111,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5095,8 +5137,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5105,7 +5151,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5113,7 +5159,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py index 107ed762e2..9e5bd7be7e 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,6 +92,7 @@ from .transports.grpc_asyncio import MetadataServiceGrpcAsyncIOTransport from .transports.rest import MetadataServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMetadataServiceRestTransport @@ -148,7 +149,7 @@ class MetadataServiceClient(metaclass=MetadataServiceClientMeta): """Service for reading and writing metadata entries.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -156,7 +157,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -166,6 +167,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -569,7 +574,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -666,7 +671,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -764,7 +769,7 @@ def __init__( self._universe_domain = MetadataServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -4909,7 +4914,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4935,8 +4940,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4945,7 +4954,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4954,7 +4963,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4968,7 +4977,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4994,8 +5003,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5004,7 +5017,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5013,7 +5026,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5027,7 +5040,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5057,8 +5070,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5067,7 +5084,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5075,7 +5092,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5083,7 +5100,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5112,8 +5129,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5122,7 +5143,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5130,7 +5151,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5138,7 +5159,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5170,8 +5191,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5180,7 +5205,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5189,7 +5214,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5203,7 +5228,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5295,8 +5320,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5305,7 +5334,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5314,7 +5345,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5328,7 +5359,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5421,8 +5452,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5431,7 +5466,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5440,7 +5477,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5454,7 +5491,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5485,8 +5522,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5495,7 +5536,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5504,7 +5547,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5518,7 +5561,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5544,8 +5587,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5554,7 +5601,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5563,7 +5610,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5577,7 +5624,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5603,8 +5650,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5613,7 +5664,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5622,7 +5673,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py index 0d9e647456..e609d2050c 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/README.rst index ff25cadba5..5482aff6ab 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MetadataServiceTransport` is the ABC for all transports. -- public child `MetadataServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MetadataServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMetadataServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MetadataServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MetadataServiceTransport`` is the ABC for all transports. + +- public child ``MetadataServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MetadataServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMetadataServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MetadataServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__init__.py index e840719c6a..2fd405dfd6 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/base.py index e08d7d7b0d..5c9340f745 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -96,6 +96,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -145,6 +149,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py index ccd938abd2..f549de5639 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -70,7 +70,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -105,7 +105,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -200,6 +200,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py index 8d5a0c222e..9b1a98dbdc 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -111,7 +111,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -251,6 +251,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py index 4434970a3b..294eeeb435 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2237,6 +2237,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MetadataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2638,6 +2644,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3040,6 +3050,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3490,6 +3504,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3936,6 +3954,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4382,6 +4404,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py index be0aa4bc7f..6ec4c0aba2 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2244,6 +2244,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMetadataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -8057,6 +8059,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -8459,6 +8465,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -8909,6 +8919,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -9355,6 +9369,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -9801,6 +9819,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py index ba1ba221a7..ed5d6a3cfd 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2492,6 +2492,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2913,6 +2917,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3382,6 +3390,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3847,6 +3859,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4312,6 +4328,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/migration_service/__init__.py index 554bbdcfaf..534d5930db 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py index 99800cc71a..585741996c 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,14 +86,22 @@ class MigrationServiceAsyncClient: parse_annotated_dataset_path = staticmethod( MigrationServiceClient.parse_annotated_dataset_path ) + auto_ml_dataset_path = staticmethod(MigrationServiceClient.auto_ml_dataset_path) + parse_auto_ml_dataset_path = staticmethod( + MigrationServiceClient.parse_auto_ml_dataset_path + ) + auto_ml_model_path = staticmethod(MigrationServiceClient.auto_ml_model_path) + parse_auto_ml_model_path = staticmethod( + MigrationServiceClient.parse_auto_ml_model_path + ) + data_labeling_dataset_path = staticmethod( + MigrationServiceClient.data_labeling_dataset_path + ) + parse_data_labeling_dataset_path = staticmethod( + MigrationServiceClient.parse_data_labeling_dataset_path + ) dataset_path = staticmethod(MigrationServiceClient.dataset_path) parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - dataset_path = staticmethod(MigrationServiceClient.dataset_path) - parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - dataset_path = staticmethod(MigrationServiceClient.dataset_path) - parse_dataset_path = staticmethod(MigrationServiceClient.parse_dataset_path) - model_path = staticmethod(MigrationServiceClient.model_path) - parse_model_path = staticmethod(MigrationServiceClient.parse_model_path) model_path = staticmethod(MigrationServiceClient.model_path) parse_model_path = staticmethod(MigrationServiceClient.parse_model_path) version_path = staticmethod(MigrationServiceClient.version_path) @@ -208,7 +216,7 @@ def transport(self) -> MigrationServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -499,11 +507,11 @@ async def sample_batch_migrate_resources(): ) # Make the request - operation = client.batch_migrate_resources(request=request) + operation = await client.batch_migrate_resources(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -607,7 +615,7 @@ async def sample_batch_migrate_resources(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -633,8 +641,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -643,7 +655,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -651,7 +663,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -662,7 +674,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -688,8 +700,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -698,7 +714,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -706,7 +722,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -717,7 +733,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -747,8 +763,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -757,7 +777,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -765,7 +785,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -773,7 +793,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -802,8 +822,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -812,7 +836,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -820,7 +844,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -828,7 +852,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -860,8 +884,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -870,7 +898,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -878,7 +906,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -889,7 +917,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -981,8 +1009,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -991,7 +1023,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -999,7 +1033,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1010,7 +1044,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1103,8 +1137,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1113,7 +1151,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1121,7 +1161,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1132,7 +1172,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1163,8 +1203,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1175,7 +1219,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1183,7 +1229,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1194,7 +1240,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1220,8 +1266,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1230,7 +1280,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1238,7 +1288,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1249,7 +1299,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1275,8 +1325,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1285,7 +1339,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1293,7 +1347,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/client.py b/google/cloud/aiplatform_v1beta1/services/migration_service/client.py index e13bbf9bd0..9b3c7acc39 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -75,6 +75,7 @@ from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport from .transports.rest import MigrationServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncMigrationServiceRestTransport @@ -133,7 +134,7 @@ class MigrationServiceClient(metaclass=MigrationServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -141,7 +142,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -151,6 +152,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -269,12 +274,12 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def dataset_path( + def auto_ml_dataset_path( project: str, location: str, dataset: str, ) -> str: - """Returns a fully-qualified dataset string.""" + """Returns a fully-qualified auto_ml_dataset string.""" return "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, location=location, @@ -282,8 +287,8 @@ def dataset_path( ) @staticmethod - def parse_dataset_path(path: str) -> Dict[str, str]: - """Parses a dataset path into its component segments.""" + def parse_auto_ml_dataset_path(path: str) -> Dict[str, str]: + """Parses a auto_ml_dataset path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", path, @@ -291,19 +296,41 @@ def parse_dataset_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def dataset_path( + def auto_ml_model_path( + project: str, + location: str, + model: str, + ) -> str: + """Returns a fully-qualified auto_ml_model string.""" + return "projects/{project}/locations/{location}/models/{model}".format( + project=project, + location=location, + model=model, + ) + + @staticmethod + def parse_auto_ml_model_path(path: str) -> Dict[str, str]: + """Parses a auto_ml_model path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/models/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def data_labeling_dataset_path( project: str, dataset: str, ) -> str: - """Returns a fully-qualified dataset string.""" + """Returns a fully-qualified data_labeling_dataset string.""" return "projects/{project}/datasets/{dataset}".format( project=project, dataset=dataset, ) @staticmethod - def parse_dataset_path(path: str) -> Dict[str, str]: - """Parses a dataset path into its component segments.""" + def parse_data_labeling_dataset_path(path: str) -> Dict[str, str]: + """Parses a data_labeling_dataset path into its component segments.""" m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) return m.groupdict() if m else {} @@ -351,28 +378,6 @@ def parse_model_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} - @staticmethod - def model_path( - project: str, - location: str, - model: str, - ) -> str: - """Returns a fully-qualified model string.""" - return "projects/{project}/locations/{location}/models/{model}".format( - project=project, - location=location, - model=model, - ) - - @staticmethod - def parse_model_path(path: str) -> Dict[str, str]: - """Parses a model path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/models/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - @staticmethod def version_path( project: str, @@ -585,7 +590,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -682,7 +687,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -780,7 +785,7 @@ def __init__( self._universe_domain = MigrationServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1203,7 +1208,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1229,8 +1234,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1239,7 +1248,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1248,7 +1257,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1262,7 +1271,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1288,8 +1297,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1298,7 +1311,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1307,7 +1320,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1321,7 +1334,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1351,8 +1364,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1361,7 +1378,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1369,7 +1386,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1377,7 +1394,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1406,8 +1423,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1416,7 +1437,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1424,7 +1445,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1432,7 +1453,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1464,8 +1485,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1474,7 +1499,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1483,7 +1508,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1497,7 +1522,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1589,8 +1614,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1599,7 +1628,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1608,7 +1639,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1622,7 +1653,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1715,8 +1746,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1725,7 +1760,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1734,7 +1771,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1748,7 +1785,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1779,8 +1816,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1789,7 +1830,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1798,7 +1841,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1812,7 +1855,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1838,8 +1881,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1848,7 +1895,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1857,7 +1904,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1871,7 +1918,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1897,8 +1944,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1907,7 +1958,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1916,7 +1967,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py index ed15cab233..7587161d67 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/README.rst index ef5e0cb2c8..e7d0f4026c 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`MigrationServiceTransport` is the ABC for all transports. -- public child `MigrationServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `MigrationServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseMigrationServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `MigrationServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``MigrationServiceTransport`` is the ABC for all transports. + +- public child ``MigrationServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``MigrationServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseMigrationServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``MigrationServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__init__.py index e8dfb59253..6123764b83 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/base.py index 6610c97141..d6768f92c2 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py index f06afd47f3..fbab486031 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py index 53d5aad17a..8fd19b105d 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py index 550880c042..822388ed60 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -517,6 +517,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[MigrationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -918,6 +924,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1320,6 +1330,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1770,6 +1784,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2216,6 +2234,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2662,6 +2684,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py index 76aaab2196..12c106d9b0 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -518,6 +518,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncMigrationServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1321,6 +1323,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1723,6 +1729,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2173,6 +2183,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2619,6 +2633,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3065,6 +3083,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py index d702be4f42..4929865cd5 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -936,6 +936,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1357,6 +1361,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1826,6 +1834,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2291,6 +2303,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2756,6 +2772,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/__init__.py index 8c77df19bb..101a1776df 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py index daf3782d3a..d20424edc9 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -204,7 +204,7 @@ def transport(self) -> ModelGardenServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -590,11 +590,11 @@ async def sample_deploy(): ) # Make the request - operation = client.deploy(request=request) + operation = await client.deploy(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -693,11 +693,11 @@ async def sample_deploy_publisher_model(): ) # Make the request - operation = client.deploy_publisher_model(request=request) + operation = await client.deploy_publisher_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -808,11 +808,11 @@ async def sample_export_publisher_model(): ) # Make the request - operation = client.export_publisher_model(request=request) + operation = await client.export_publisher_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1144,7 +1144,7 @@ async def sample_accept_publisher_model_eula(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1170,8 +1170,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1180,7 +1184,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1188,7 +1192,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1199,7 +1203,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1225,8 +1229,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1235,7 +1243,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1243,7 +1251,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1254,7 +1262,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1284,8 +1292,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1294,7 +1306,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1302,7 +1314,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1310,7 +1322,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1339,8 +1351,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1349,7 +1365,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1357,7 +1373,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1365,7 +1381,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1397,8 +1413,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1407,7 +1427,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1415,7 +1435,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1426,7 +1446,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1518,8 +1538,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1528,7 +1552,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1536,7 +1562,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1547,7 +1573,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1640,8 +1666,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1650,7 +1680,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1658,7 +1690,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1669,7 +1701,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1700,8 +1732,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1712,7 +1748,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1720,7 +1758,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1731,7 +1769,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1757,8 +1795,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1767,7 +1809,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1775,7 +1817,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1786,7 +1828,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1812,8 +1854,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1822,7 +1868,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1830,7 +1876,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py index da67f9d8e4..dbff0844f6 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ from .transports.grpc_asyncio import ModelGardenServiceGrpcAsyncIOTransport from .transports.rest import ModelGardenServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncModelGardenServiceRestTransport @@ -132,7 +133,7 @@ class ModelGardenServiceClient(metaclass=ModelGardenServiceClientMeta): """The interface of Model Garden Service.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -140,7 +141,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -150,6 +151,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -518,7 +523,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -615,7 +620,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -715,7 +720,7 @@ def __init__( self._universe_domain = ModelGardenServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1669,7 +1674,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1695,8 +1700,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1705,7 +1714,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1714,7 +1723,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1728,7 +1737,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1754,8 +1763,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1764,7 +1777,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1773,7 +1786,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1787,7 +1800,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1817,8 +1830,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1827,7 +1844,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1835,7 +1852,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1843,7 +1860,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1872,8 +1889,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1882,7 +1903,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1890,7 +1911,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1898,7 +1919,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1930,8 +1951,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1940,7 +1965,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1949,7 +1974,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1963,7 +1988,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2055,8 +2080,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2065,7 +2094,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2074,7 +2105,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2088,7 +2119,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2181,8 +2212,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2191,7 +2226,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2200,7 +2237,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2214,7 +2251,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2245,8 +2282,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2255,7 +2296,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2264,7 +2307,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2278,7 +2321,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2304,8 +2347,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2314,7 +2361,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2323,7 +2370,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2337,7 +2384,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2363,8 +2410,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2373,7 +2424,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2382,7 +2433,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py index 99c48d9789..6427eea993 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/README.rst index 9056265ed7..b3ac6736ab 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ModelGardenServiceTransport` is the ABC for all transports. -- public child `ModelGardenServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ModelGardenServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseModelGardenServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ModelGardenServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ModelGardenServiceTransport`` is the ABC for all transports. + +- public child ``ModelGardenServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ModelGardenServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseModelGardenServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ModelGardenServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__init__.py index 3a1a431c25..cb5fe19542 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/base.py index 3f5a1bcdec..d8221cd727 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py index 0e1ab09772..7395aef69e 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py index f216e70281..431928dc6e 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py index 3b942b1f7b..a2ee7becb7 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -807,6 +807,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ModelGardenServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1208,6 +1214,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1610,6 +1620,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2060,6 +2074,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2506,6 +2524,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2952,6 +2974,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py index 705aac85c1..fa7ff30e98 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -808,6 +808,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncModelGardenServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2456,6 +2458,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2858,6 +2864,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3308,6 +3318,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3754,6 +3768,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4200,6 +4218,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py index c300162c44..15aac8ffc3 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1208,6 +1208,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1629,6 +1633,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2098,6 +2106,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2563,6 +2575,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3028,6 +3044,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/__init__.py index 0f1071476d..e06b1dab62 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py index a40a9469ec..f8b698bdbd 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ def transport(self) -> ModelMonitoringServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -389,11 +389,11 @@ async def sample_create_model_monitor(): ) # Make the request - operation = client.create_model_monitor(request=request) + operation = await client.create_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -526,11 +526,11 @@ async def sample_update_model_monitor(): ) # Make the request - operation = client.update_model_monitor(request=request) + operation = await client.update_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -914,11 +914,11 @@ async def sample_delete_model_monitor(): ) # Make the request - operation = client.delete_model_monitor(request=request) + operation = await client.delete_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1430,11 +1430,11 @@ async def sample_delete_model_monitoring_job(): ) # Make the request - operation = client.delete_model_monitoring_job(request=request) + operation = await client.delete_model_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1805,7 +1805,7 @@ async def sample_search_model_monitoring_alerts(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1831,8 +1831,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1841,7 +1845,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1849,7 +1853,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1860,7 +1864,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1886,8 +1890,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1896,7 +1904,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1904,7 +1912,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1915,7 +1923,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1945,8 +1953,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1955,7 +1967,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1963,7 +1975,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1971,7 +1983,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2000,8 +2012,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2010,7 +2026,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2018,7 +2034,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2026,7 +2042,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2058,8 +2074,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2068,7 +2088,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2076,7 +2096,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2087,7 +2107,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2179,8 +2199,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2189,7 +2213,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2197,7 +2223,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2208,7 +2234,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2301,8 +2327,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2311,7 +2341,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2319,7 +2351,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2330,7 +2362,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2361,8 +2393,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2373,7 +2409,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2381,7 +2419,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2392,7 +2430,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2418,8 +2456,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2428,7 +2470,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2436,7 +2478,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2447,7 +2489,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2473,8 +2515,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2483,7 +2529,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2491,7 +2537,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py index 2916283462..a22a4c966d 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -90,6 +90,7 @@ from .transports.grpc_asyncio import ModelMonitoringServiceGrpcAsyncIOTransport from .transports.rest import ModelMonitoringServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncModelMonitoringServiceRestTransport @@ -149,7 +150,7 @@ class ModelMonitoringServiceClient(metaclass=ModelMonitoringServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -157,7 +158,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -167,6 +168,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -630,7 +635,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -729,7 +734,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -829,7 +834,7 @@ def __init__( self._universe_domain = ModelMonitoringServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2397,7 +2402,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2423,8 +2428,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2433,7 +2442,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2442,7 +2451,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2456,7 +2465,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2482,8 +2491,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2492,7 +2505,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2501,7 +2514,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2515,7 +2528,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2545,8 +2558,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2555,7 +2572,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2563,7 +2580,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2571,7 +2588,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2600,8 +2617,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2610,7 +2631,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2618,7 +2639,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2626,7 +2647,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2658,8 +2679,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2668,7 +2693,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2677,7 +2702,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2691,7 +2716,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2783,8 +2808,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2793,7 +2822,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2802,7 +2833,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2816,7 +2847,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2909,8 +2940,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2919,7 +2954,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2928,7 +2965,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2942,7 +2979,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2973,8 +3010,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2983,7 +3024,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2992,7 +3035,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3006,7 +3049,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3032,8 +3075,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3042,7 +3089,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3051,7 +3098,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3065,7 +3112,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3091,8 +3138,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3101,7 +3152,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3110,7 +3161,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py index 07b31e5fe0..e9a0efc327 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/README.rst index 918ec90705..a41b4a2027 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ModelMonitoringServiceTransport` is the ABC for all transports. -- public child `ModelMonitoringServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ModelMonitoringServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseModelMonitoringServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ModelMonitoringServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ModelMonitoringServiceTransport`` is the ABC for all transports. + +- public child ``ModelMonitoringServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ModelMonitoringServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseModelMonitoringServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ModelMonitoringServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__init__.py index eb604f3b0d..51534bb626 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/base.py index 8b9265b1fa..b9d94803b5 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -91,6 +91,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -140,6 +144,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py index 5ee8f45690..d28de90bb1 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -100,7 +100,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -197,6 +197,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py index 86cae05ef9..6c181f4659 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -248,6 +248,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py index 4ba43d089d..bdda816207 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1050,6 +1050,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ModelMonitoringServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1451,6 +1457,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1853,6 +1863,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2303,6 +2317,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2749,6 +2767,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3195,6 +3217,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py index 85af3b9077..c8cad5e260 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1053,6 +1053,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncModelMonitoringServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -3384,6 +3386,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3786,6 +3792,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4236,6 +4246,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4682,6 +4696,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -5128,6 +5146,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py index ee83e64216..ca04020071 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1408,6 +1408,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1829,6 +1833,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2298,6 +2306,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2763,6 +2775,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3228,6 +3244,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_service/__init__.py index aa17eabb4a..31396a3232 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py index ad891c0ebf..245a968dc3 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ def transport(self) -> ModelServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -368,11 +368,11 @@ async def sample_upload_model(): ) # Make the request - operation = client.upload_model(request=request) + operation = await client.upload_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1159,11 +1159,11 @@ async def sample_update_explanation_dataset(): ) # Make the request - operation = client.update_explanation_dataset(request=request) + operation = await client.update_explanation_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1294,11 +1294,11 @@ async def sample_delete_model(): ) # Make the request - operation = client.delete_model(request=request) + operation = await client.delete_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1435,11 +1435,11 @@ async def sample_delete_model_version(): ) # Make the request - operation = client.delete_model_version(request=request) + operation = await client.delete_model_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1711,11 +1711,11 @@ async def sample_export_model(): ) # Make the request - operation = client.export_model(request=request) + operation = await client.export_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1858,11 +1858,11 @@ async def sample_copy_model(): ) # Make the request - operation = client.copy_model(request=request) + operation = await client.copy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2923,7 +2923,7 @@ async def sample_recommend_spec(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2949,8 +2949,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2959,7 +2963,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2967,7 +2971,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2978,7 +2982,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3004,8 +3008,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3014,7 +3022,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3022,7 +3030,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3033,7 +3041,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3063,8 +3071,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3073,7 +3085,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3081,7 +3093,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3089,7 +3101,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3118,8 +3130,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3128,7 +3144,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3136,7 +3152,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3144,7 +3160,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3176,8 +3192,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3186,7 +3206,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3194,7 +3214,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3205,7 +3225,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3297,8 +3317,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3307,7 +3331,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3315,7 +3341,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3326,7 +3352,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3419,8 +3445,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3429,7 +3459,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3437,7 +3469,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3448,7 +3480,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3479,8 +3511,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3491,7 +3527,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3499,7 +3537,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3510,7 +3548,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3536,8 +3574,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3546,7 +3588,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3554,7 +3596,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3565,7 +3607,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3591,8 +3633,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3601,7 +3647,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3609,7 +3655,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_service/client.py index cc9c10ec62..acf8c27106 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -90,6 +90,7 @@ from .transports.grpc_asyncio import ModelServiceGrpcAsyncIOTransport from .transports.rest import ModelServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncModelServiceRestTransport @@ -144,7 +145,7 @@ class ModelServiceClient(metaclass=ModelServiceClientMeta): """A service for managing Vertex AI's machine learning Models.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -152,7 +153,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -162,6 +163,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -585,7 +590,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -682,7 +687,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -778,7 +783,7 @@ def __init__( self._universe_domain = ModelServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3459,7 +3464,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3485,8 +3490,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3495,7 +3504,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3504,7 +3513,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3518,7 +3527,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3544,8 +3553,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3554,7 +3567,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3563,7 +3576,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3577,7 +3590,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3607,8 +3620,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3617,7 +3634,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3625,7 +3642,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3633,7 +3650,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3662,8 +3679,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3672,7 +3693,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3680,7 +3701,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3688,7 +3709,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3720,8 +3741,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3730,7 +3755,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3739,7 +3764,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3753,7 +3778,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3845,8 +3870,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3855,7 +3884,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3864,7 +3895,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3878,7 +3909,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3971,8 +4002,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3981,7 +4016,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3990,7 +4027,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4004,7 +4041,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4035,8 +4072,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4045,7 +4086,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4054,7 +4097,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4068,7 +4111,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4094,8 +4137,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4104,7 +4151,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4113,7 +4160,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4127,7 +4174,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4153,8 +4200,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4163,7 +4214,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4172,7 +4223,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py index 4d3a21f3e2..67b8ebf460 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/model_service/transports/README.rst index 05dddc4c34..a3b272dc76 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ModelServiceTransport` is the ABC for all transports. -- public child `ModelServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ModelServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseModelServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ModelServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ModelServiceTransport`` is the ABC for all transports. + +- public child ``ModelServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ModelServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseModelServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ModelServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/__init__.py index 5a7ceaa106..c6a3f8dd13 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/base.py index fef5311a2e..5699d47619 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -142,6 +146,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py index 6647806985..172ee41055 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -197,6 +197,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py index 86e0635e04..4e17ab8739 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -108,7 +108,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -248,6 +248,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py index cc4320dc04..e209697993 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1549,6 +1549,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ModelServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1950,6 +1956,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2352,6 +2362,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2802,6 +2816,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3248,6 +3266,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3694,6 +3716,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py index 141b5ce8c0..50df303602 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1550,6 +1550,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncModelServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -5410,6 +5412,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -5812,6 +5818,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6262,6 +6272,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -6708,6 +6722,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -7154,6 +7172,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py index 7b60e3ad8b..c738047d55 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1875,6 +1875,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2296,6 +2300,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2765,6 +2773,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3230,6 +3242,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3695,6 +3711,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/__init__.py index 2cb87d3354..6ab99c5356 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py index 209bdeba6c..b620865876 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -237,7 +237,7 @@ def transport(self) -> NotebookServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -391,11 +391,11 @@ async def sample_create_notebook_runtime_template(): ) # Make the request - operation = client.create_notebook_runtime_template(request=request) + operation = await client.create_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -793,11 +793,11 @@ async def sample_delete_notebook_runtime_template(): ) # Make the request - operation = client.delete_notebook_runtime_template(request=request) + operation = await client.delete_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1087,11 +1087,11 @@ async def sample_assign_notebook_runtime(): ) # Make the request - operation = client.assign_notebook_runtime(request=request) + operation = await client.assign_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1506,11 +1506,11 @@ async def sample_delete_notebook_runtime(): ) # Make the request - operation = client.delete_notebook_runtime(request=request) + operation = await client.delete_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1646,11 +1646,11 @@ async def sample_upgrade_notebook_runtime(): ) # Make the request - operation = client.upgrade_notebook_runtime(request=request) + operation = await client.upgrade_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1778,11 +1778,11 @@ async def sample_start_notebook_runtime(): ) # Make the request - operation = client.start_notebook_runtime(request=request) + operation = await client.start_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1910,11 +1910,11 @@ async def sample_stop_notebook_runtime(): ) # Make the request - operation = client.stop_notebook_runtime(request=request) + operation = await client.stop_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2052,11 +2052,11 @@ async def sample_create_notebook_execution_job(): ) # Make the request - operation = client.create_notebook_execution_job(request=request) + operation = await client.create_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2442,11 +2442,11 @@ async def sample_delete_notebook_execution_job(): ) # Make the request - operation = client.delete_notebook_execution_job(request=request) + operation = await client.delete_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2546,7 +2546,7 @@ async def sample_delete_notebook_execution_job(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2572,8 +2572,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2582,7 +2586,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2590,7 +2594,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2601,7 +2605,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2627,8 +2631,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2637,7 +2645,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2645,7 +2653,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2656,7 +2664,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2686,8 +2694,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2696,7 +2708,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2704,7 +2716,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2712,7 +2724,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2741,8 +2753,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2751,7 +2767,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2759,7 +2775,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2767,7 +2783,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2799,8 +2815,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2809,7 +2829,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2817,7 +2837,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2828,7 +2848,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2920,8 +2940,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2930,7 +2954,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2938,7 +2964,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2949,7 +2975,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3042,8 +3068,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3052,7 +3082,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3060,7 +3092,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3071,7 +3103,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3102,8 +3134,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3114,7 +3150,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3122,7 +3160,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3133,7 +3171,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3159,8 +3197,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3169,7 +3211,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3177,7 +3219,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3188,7 +3230,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3214,8 +3256,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3224,7 +3270,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3232,7 +3278,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py index 8793b3066c..e890a26551 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -96,6 +96,7 @@ from .transports.grpc_asyncio import NotebookServiceGrpcAsyncIOTransport from .transports.rest import NotebookServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncNotebookServiceRestTransport @@ -154,7 +155,7 @@ class NotebookServiceClient(metaclass=NotebookServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -162,7 +163,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -172,6 +173,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -608,7 +613,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -705,7 +710,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -803,7 +808,7 @@ def __init__( self._universe_domain = NotebookServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3109,7 +3114,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3135,8 +3140,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3145,7 +3154,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3154,7 +3163,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3168,7 +3177,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3194,8 +3203,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3204,7 +3217,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3213,7 +3226,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3227,7 +3240,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3257,8 +3270,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3267,7 +3284,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3275,7 +3292,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3283,7 +3300,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3312,8 +3329,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3322,7 +3343,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3330,7 +3351,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3338,7 +3359,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3370,8 +3391,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3380,7 +3405,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3389,7 +3414,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3403,7 +3428,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3495,8 +3520,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3505,7 +3534,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3514,7 +3545,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3528,7 +3559,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3621,8 +3652,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3631,7 +3666,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3640,7 +3677,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3654,7 +3691,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3685,8 +3722,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3695,7 +3736,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3704,7 +3747,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3718,7 +3761,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3744,8 +3787,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3754,7 +3801,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3763,7 +3810,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3777,7 +3824,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3803,8 +3850,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3813,7 +3864,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3822,7 +3873,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py index 5cc82493c8..38ac026c4e 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/README.rst index 3fed6e856a..e5b831f665 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`NotebookServiceTransport` is the ABC for all transports. -- public child `NotebookServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `NotebookServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseNotebookServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `NotebookServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``NotebookServiceTransport`` is the ABC for all transports. + +- public child ``NotebookServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``NotebookServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseNotebookServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``NotebookServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__init__.py index e7b59a5466..448ef1f61b 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/base.py index 7fb6e4c15b..98833ba79c 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py index 77fdedbe31..ace1fed03d 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py index 28d4aadb21..f803cc05d9 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py index 415b290198..0dbba37466 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1334,6 +1334,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[NotebookServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1735,6 +1741,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2137,6 +2147,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2587,6 +2601,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3033,6 +3051,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3479,6 +3501,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py index 65f4998efe..2e1ba5f217 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1335,6 +1335,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncNotebookServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -4521,6 +4523,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -4923,6 +4929,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -5373,6 +5383,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -5819,6 +5833,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -6265,6 +6283,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py index 24080e63b1..5f0cf651a5 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1656,6 +1656,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2077,6 +2081,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2546,6 +2554,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3011,6 +3023,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3476,6 +3492,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/__init__.py index fe1d097a81..47239a01ca 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/async_client.py index a944717277..4f5152bb8f 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -209,7 +209,7 @@ def transport(self) -> OnlineEvaluatorServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -366,11 +366,11 @@ async def sample_create_online_evaluator(): ) # Make the request - operation = client.create_online_evaluator(request=request) + operation = await client.create_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -629,11 +629,11 @@ async def sample_update_online_evaluator(): ) # Make the request - operation = client.update_online_evaluator(request=request) + operation = await client.update_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -774,11 +774,11 @@ async def sample_delete_online_evaluator(): ) # Make the request - operation = client.delete_online_evaluator(request=request) + operation = await client.delete_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1044,11 +1044,11 @@ async def sample_activate_online_evaluator(): ) # Make the request - operation = client.activate_online_evaluator(request=request) + operation = await client.activate_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1178,11 +1178,11 @@ async def sample_suspend_online_evaluator(): ) # Make the request - operation = client.suspend_online_evaluator(request=request) + operation = await client.suspend_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1278,7 +1278,7 @@ async def sample_suspend_online_evaluator(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1304,8 +1304,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1314,7 +1318,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1322,7 +1326,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1333,7 +1337,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1359,8 +1363,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1369,7 +1377,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1377,7 +1385,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1388,7 +1396,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1418,8 +1426,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1428,7 +1440,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1436,7 +1448,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1444,7 +1456,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1473,8 +1485,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1483,7 +1499,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1491,7 +1507,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1499,7 +1515,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1531,8 +1547,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1541,7 +1561,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1549,7 +1569,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1560,7 +1580,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1652,8 +1672,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1662,7 +1686,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1670,7 +1696,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1681,7 +1707,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1774,8 +1800,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1784,7 +1814,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1792,7 +1824,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1803,7 +1835,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1834,8 +1866,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1846,7 +1882,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1854,7 +1892,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1865,7 +1903,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1891,8 +1929,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1901,7 +1943,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1909,7 +1951,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1920,7 +1962,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1946,8 +1988,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1956,7 +2002,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1964,7 +2010,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/client.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/client.py index 2bbe3ff57a..ba1b667453 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import OnlineEvaluatorServiceGrpcAsyncIOTransport from .transports.rest import OnlineEvaluatorServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncOnlineEvaluatorServiceRestTransport @@ -140,7 +141,7 @@ class OnlineEvaluatorServiceClient(metaclass=OnlineEvaluatorServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -148,7 +149,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -158,6 +159,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -465,7 +470,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -564,7 +569,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -664,7 +669,7 @@ def __init__( self._universe_domain = OnlineEvaluatorServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1740,7 +1745,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1766,8 +1771,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1776,7 +1785,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1785,7 +1794,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1799,7 +1808,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1825,8 +1834,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1835,7 +1848,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1844,7 +1857,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1858,7 +1871,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1888,8 +1901,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1898,7 +1915,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1906,7 +1923,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1914,7 +1931,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1943,8 +1960,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1953,7 +1974,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1961,7 +1982,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1969,7 +1990,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2001,8 +2022,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2011,7 +2036,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2020,7 +2045,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2034,7 +2059,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2126,8 +2151,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2136,7 +2165,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2145,7 +2176,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2159,7 +2190,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2252,8 +2283,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2262,7 +2297,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2271,7 +2308,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2285,7 +2322,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2316,8 +2353,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2326,7 +2367,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2335,7 +2378,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2349,7 +2392,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2375,8 +2418,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2385,7 +2432,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2394,7 +2441,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2408,7 +2455,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2434,8 +2481,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2444,7 +2495,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2453,7 +2504,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/pagers.py index 5bd1e89575..0681befb5d 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/README.rst index 79bc29b005..e3bf0e9723 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`OnlineEvaluatorServiceTransport` is the ABC for all transports. -- public child `OnlineEvaluatorServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `OnlineEvaluatorServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseOnlineEvaluatorServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `OnlineEvaluatorServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``OnlineEvaluatorServiceTransport`` is the ABC for all transports. + +- public child ``OnlineEvaluatorServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``OnlineEvaluatorServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseOnlineEvaluatorServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``OnlineEvaluatorServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/__init__.py index 0be78bcedc..b32346c41e 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/base.py index 95f53b9043..bedabd78f1 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc.py index 39a49772a0..1dbc78cdd8 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc_asyncio.py index e3c196c5e0..096c5f3c04 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest.py index 56d8dfee93..b4a7ed1c1d 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -805,6 +805,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[OnlineEvaluatorServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1206,6 +1212,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1608,6 +1618,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2058,6 +2072,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2504,6 +2522,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2950,6 +2972,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_asyncio.py index 85b855f4a9..53c2bb3fdf 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -808,6 +808,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncOnlineEvaluatorServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2454,6 +2456,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2856,6 +2862,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3306,6 +3316,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3752,6 +3766,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4198,6 +4216,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_base.py index 8d6c3b19c6..2a44d92288 100644 --- a/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/online_evaluator_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1204,6 +1204,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1625,6 +1629,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2094,6 +2102,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2559,6 +2571,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3024,6 +3040,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/__init__.py index 4101a7ab7e..54e2eb89d2 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py index 612dcb9cc9..b3830636e3 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -238,7 +238,7 @@ def transport(self) -> PersistentResourceServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -391,11 +391,11 @@ async def sample_create_persistent_resource(): ) # Make the request - operation = client.create_persistent_resource(request=request) + operation = await client.create_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -799,11 +799,11 @@ async def sample_delete_persistent_resource(): ) # Make the request - operation = client.delete_persistent_resource(request=request) + operation = await client.delete_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -941,11 +941,11 @@ async def sample_update_persistent_resource(): ) # Make the request - operation = client.update_persistent_resource(request=request) + operation = await client.update_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1089,11 +1089,11 @@ async def sample_reboot_persistent_resource(): ) # Make the request - operation = client.reboot_persistent_resource(request=request) + operation = await client.reboot_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1191,7 +1191,7 @@ async def sample_reboot_persistent_resource(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1217,8 +1217,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1227,7 +1231,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1235,7 +1239,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1246,7 +1250,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1272,8 +1276,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1282,7 +1290,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1290,7 +1298,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1301,7 +1309,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1331,8 +1339,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1341,7 +1353,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1349,7 +1361,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1357,7 +1369,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1386,8 +1398,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1396,7 +1412,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1404,7 +1420,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1412,7 +1428,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1444,8 +1460,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1454,7 +1474,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1462,7 +1482,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1473,7 +1493,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1565,8 +1585,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1575,7 +1599,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1583,7 +1609,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1594,7 +1620,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1687,8 +1713,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1697,7 +1727,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1705,7 +1737,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1716,7 +1748,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1747,8 +1779,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1759,7 +1795,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1767,7 +1805,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1778,7 +1816,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1804,8 +1842,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1814,7 +1856,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1822,7 +1864,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1833,7 +1875,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1859,8 +1901,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1869,7 +1915,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1877,7 +1923,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py index fe63f91b3b..769e878cb2 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -85,6 +85,7 @@ from .transports.grpc_asyncio import PersistentResourceServiceGrpcAsyncIOTransport from .transports.rest import PersistentResourceServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPersistentResourceServiceRestTransport @@ -145,7 +146,7 @@ class PersistentResourceServiceClient(metaclass=PersistentResourceServiceClientM """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -153,7 +154,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -163,6 +164,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -555,7 +560,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -654,7 +659,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -756,7 +761,7 @@ def __init__( self._universe_domain = PersistentResourceServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1727,7 +1732,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1753,8 +1758,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1763,7 +1772,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1772,7 +1781,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1786,7 +1795,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1812,8 +1821,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1822,7 +1835,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1831,7 +1844,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1845,7 +1858,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1875,8 +1888,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1885,7 +1902,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1893,7 +1910,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1901,7 +1918,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1930,8 +1947,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1940,7 +1961,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1948,7 +1969,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1956,7 +1977,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1988,8 +2009,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1998,7 +2023,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2007,7 +2032,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2021,7 +2046,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2113,8 +2138,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2123,7 +2152,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2132,7 +2163,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2146,7 +2177,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2239,8 +2270,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2249,7 +2284,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2258,7 +2295,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2272,7 +2309,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2303,8 +2340,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2313,7 +2354,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2322,7 +2365,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2336,7 +2379,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2362,8 +2405,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2372,7 +2419,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2381,7 +2428,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2395,7 +2442,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2421,8 +2468,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2431,7 +2482,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2440,7 +2491,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py index 7f3228527c..8d5d4df2b0 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/README.rst index 9123900bcc..48cb30b174 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PersistentResourceServiceTransport` is the ABC for all transports. -- public child `PersistentResourceServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PersistentResourceServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePersistentResourceServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PersistentResourceServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PersistentResourceServiceTransport`` is the ABC for all transports. + +- public child ``PersistentResourceServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PersistentResourceServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePersistentResourceServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PersistentResourceServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__init__.py index 9e0e3549e6..91066e6327 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/base.py index 7c2780bebe..d4df43ad0a 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py index d3cb8e80cd..1eb83f8e42 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py index 1d3d625278..3ed477ce20 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py index 7ac71606e9..c586597374 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -750,6 +750,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PersistentResourceServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1151,6 +1157,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1553,6 +1563,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2003,6 +2017,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2449,6 +2467,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2895,6 +2917,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py index 74ed997973..66c6984e3f 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -751,6 +751,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPersistentResourceServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2241,6 +2243,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2643,6 +2649,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3093,6 +3103,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3539,6 +3553,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3985,6 +4003,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py index 1df91b54bb..98cab41b79 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1151,6 +1151,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1572,6 +1576,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2041,6 +2049,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2506,6 +2518,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2971,6 +2987,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/__init__.py index 3fb034d0b0..e1d5d515e4 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py index 8485baf0eb..bb18f40d2b 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -236,7 +236,7 @@ def transport(self) -> PipelineServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -764,11 +764,11 @@ async def sample_delete_training_pipeline(): ) # Make the request - operation = client.delete_training_pipeline(request=request) + operation = await client.delete_training_pipeline(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1389,11 +1389,11 @@ async def sample_delete_pipeline_job(): ) # Make the request - operation = client.delete_pipeline_job(request=request) + operation = await client.delete_pipeline_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1530,11 +1530,11 @@ async def sample_batch_delete_pipeline_jobs(): ) # Make the request - operation = client.batch_delete_pipeline_jobs(request=request) + operation = await client.batch_delete_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1791,11 +1791,11 @@ async def sample_batch_cancel_pipeline_jobs(): ) # Make the request - operation = client.batch_cancel_pipeline_jobs(request=request) + operation = await client.batch_cancel_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1897,7 +1897,7 @@ async def sample_batch_cancel_pipeline_jobs(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1923,8 +1923,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1933,7 +1937,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1941,7 +1945,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1952,7 +1956,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1978,8 +1982,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1988,7 +1996,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1996,7 +2004,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2007,7 +2015,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2037,8 +2045,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2047,7 +2059,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2055,7 +2067,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2063,7 +2075,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2092,8 +2104,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2102,7 +2118,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2110,7 +2126,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2118,7 +2134,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2150,8 +2166,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2160,7 +2180,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2168,7 +2188,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2179,7 +2199,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2271,8 +2291,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2281,7 +2305,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2289,7 +2315,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2300,7 +2326,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2393,8 +2419,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2403,7 +2433,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2411,7 +2443,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2422,7 +2454,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2453,8 +2485,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2465,7 +2501,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2473,7 +2511,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2484,7 +2522,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2510,8 +2548,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2520,7 +2562,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2528,7 +2570,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2539,7 +2581,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2565,8 +2607,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2575,7 +2621,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2583,7 +2629,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py index d13d42614b..b6ec07397f 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,7 @@ from .transports.grpc_asyncio import PipelineServiceGrpcAsyncIOTransport from .transports.rest import PipelineServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPipelineServiceRestTransport @@ -149,7 +150,7 @@ class PipelineServiceClient(metaclass=PipelineServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -157,7 +158,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -167,6 +168,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -675,7 +680,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -772,7 +777,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -870,7 +875,7 @@ def __init__( self._universe_domain = PipelineServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2526,7 +2531,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2552,8 +2557,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2562,7 +2571,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2571,7 +2580,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2585,7 +2594,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2611,8 +2620,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2621,7 +2634,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2630,7 +2643,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2644,7 +2657,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2674,8 +2687,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2684,7 +2701,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2692,7 +2709,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2700,7 +2717,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2729,8 +2746,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2739,7 +2760,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2747,7 +2768,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2755,7 +2776,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2787,8 +2808,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2797,7 +2822,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2806,7 +2831,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2820,7 +2845,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2912,8 +2937,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2922,7 +2951,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2931,7 +2962,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2945,7 +2976,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3038,8 +3069,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3048,7 +3083,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3057,7 +3094,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3071,7 +3108,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3102,8 +3139,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3112,7 +3153,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3121,7 +3164,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3135,7 +3178,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3161,8 +3204,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3171,7 +3218,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3180,7 +3227,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3194,7 +3241,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3220,8 +3267,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3230,7 +3281,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3239,7 +3290,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py index e6d48e62fa..18ff1c8dae 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/README.rst index b5f17d1cea..82250888a7 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PipelineServiceTransport` is the ABC for all transports. -- public child `PipelineServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PipelineServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePipelineServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PipelineServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PipelineServiceTransport`` is the ABC for all transports. + +- public child ``PipelineServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PipelineServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePipelineServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PipelineServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__init__.py index 516241d5cc..7f2a969df2 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/base.py index 5519663418..811327dc03 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -142,6 +146,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py index 3078af0b70..0c03becd16 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -200,6 +200,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py index cb90972161..feab3658a0 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -108,7 +108,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -251,6 +251,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py index 515b4df879..29d9f101de 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1026,6 +1026,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PipelineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1427,6 +1433,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1829,6 +1839,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2279,6 +2293,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2725,6 +2743,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3171,6 +3193,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py index e19bf212a9..d12ac10651 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1027,6 +1027,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPipelineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -3420,6 +3422,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -3822,6 +3828,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4272,6 +4282,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4718,6 +4732,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -5164,6 +5182,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py index 8dc0021234..6c97b67f6e 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1453,6 +1453,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1874,6 +1878,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2343,6 +2351,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2808,6 +2820,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3273,6 +3289,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/__init__.py index 4d2d0a66bb..d337f04e31 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py index acfc17ada1..cae10869c8 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -210,7 +210,7 @@ def transport(self) -> PredictionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -2356,7 +2356,7 @@ async def sample_embed_content(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2382,8 +2382,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2392,7 +2396,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2400,7 +2404,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2411,7 +2415,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2437,8 +2441,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2447,7 +2455,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2455,7 +2463,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2466,7 +2474,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2496,8 +2504,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2506,7 +2518,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2514,7 +2526,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2522,7 +2534,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2551,8 +2563,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2561,7 +2577,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2569,7 +2585,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2577,7 +2593,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2609,8 +2625,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2619,7 +2639,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2627,7 +2647,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2638,7 +2658,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2730,8 +2750,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2740,7 +2764,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2748,7 +2774,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2759,7 +2785,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2852,8 +2878,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2862,7 +2892,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2870,7 +2902,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2881,7 +2913,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2912,8 +2944,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2924,7 +2960,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2932,7 +2970,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2943,7 +2981,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2969,8 +3007,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2979,7 +3021,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2987,7 +3029,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2998,7 +3040,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3024,8 +3066,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3034,7 +3080,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3042,7 +3088,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py index 8671e85bae..62a58e7873 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import PredictionServiceGrpcAsyncIOTransport from .transports.rest import PredictionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncPredictionServiceRestTransport @@ -138,7 +139,7 @@ class PredictionServiceClient(metaclass=PredictionServiceClientMeta): """A service for online predictions and explanations.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -551,7 +556,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -648,7 +653,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -748,7 +753,7 @@ def __init__( self._universe_domain = PredictionServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2883,7 +2888,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2909,8 +2914,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2919,7 +2928,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2928,7 +2937,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2942,7 +2951,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2968,8 +2977,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2978,7 +2991,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2987,7 +3000,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3001,7 +3014,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3031,8 +3044,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3041,7 +3058,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3049,7 +3066,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3057,7 +3074,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3086,8 +3103,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3096,7 +3117,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3104,7 +3125,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3112,7 +3133,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3144,8 +3165,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3154,7 +3179,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3163,7 +3188,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3177,7 +3202,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3269,8 +3294,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3279,7 +3308,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3288,7 +3319,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3302,7 +3333,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3395,8 +3426,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3405,7 +3440,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3414,7 +3451,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3428,7 +3465,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3459,8 +3496,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3469,7 +3510,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3478,7 +3521,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3492,7 +3535,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3518,8 +3561,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3528,7 +3575,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3537,7 +3584,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3551,7 +3598,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3577,8 +3624,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3587,7 +3638,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3596,7 +3647,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/README.rst index 504aaca0a1..409d7c7b9f 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`PredictionServiceTransport` is the ABC for all transports. -- public child `PredictionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `PredictionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BasePredictionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `PredictionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``PredictionServiceTransport`` is the ABC for all transports. + +- public child ``PredictionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``PredictionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BasePredictionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``PredictionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__init__.py index 11ab649247..c089208274 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/base.py index 761cc3091c..f63626060e 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py index bf3858e2bd..a820a41fcb 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py index e2f688b110..da6521b0eb 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py index 7069b30fdd..6ca70756d3 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1102,6 +1102,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[PredictionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py index 5b6afda10f..d95d78d685 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1106,6 +1106,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncPredictionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py index 1824e3afe0..c9b8b9e9bb 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1573,6 +1573,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1994,6 +1998,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2463,6 +2471,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2928,6 +2940,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3393,6 +3409,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/__init__.py index 34067168e9..1f1d02c66e 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py index ee9ebbf6fd..235fd30c6b 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -214,7 +214,7 @@ def transport(self) -> ReasoningEngineExecutionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -599,11 +599,11 @@ async def sample_async_query_reasoning_engine(): ) # Make the request - operation = client.async_query_reasoning_engine(request=request) + operation = await client.async_query_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -674,9 +674,106 @@ async def sample_async_query_reasoning_engine(): # Done; return the response. return response + async def cancel_async_query_reasoning_engine( + self, + request: Optional[ + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Cancels an AsyncQueryReasoningEngine operation. + + .. 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 aiplatform_v1beta1 + + async def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = await client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineRequest, dict]]): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + ): + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[ + self._client._transport.cancel_async_query_reasoning_engine + ] + + # 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),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -702,8 +799,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -712,7 +813,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -720,7 +821,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -731,7 +832,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -757,8 +858,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -767,7 +872,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -775,7 +880,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -786,7 +891,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -816,8 +921,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -826,7 +935,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -834,7 +943,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -842,7 +951,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -871,8 +980,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -881,7 +994,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -889,7 +1002,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -897,7 +1010,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -929,8 +1042,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -939,7 +1056,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -947,7 +1064,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -958,7 +1075,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1050,8 +1167,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1060,7 +1181,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1068,7 +1191,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1079,7 +1202,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1172,8 +1295,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1182,7 +1309,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1190,7 +1319,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1201,7 +1330,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1232,8 +1361,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1244,7 +1377,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1252,7 +1387,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1263,7 +1398,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1289,8 +1424,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1299,7 +1438,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1307,7 +1446,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1318,7 +1457,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1344,8 +1483,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1354,7 +1497,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1362,7 +1505,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py index b29135e3e4..343e3d043e 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,6 +80,7 @@ from .transports.grpc_asyncio import ReasoningEngineExecutionServiceGrpcAsyncIOTransport from .transports.rest import ReasoningEngineExecutionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import ( AsyncReasoningEngineExecutionServiceRestTransport, @@ -144,7 +145,7 @@ class ReasoningEngineExecutionServiceClient( """A service for executing queries on Reasoning Engine.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -152,7 +153,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -162,6 +163,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -473,7 +478,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -572,7 +577,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -676,7 +681,7 @@ def __init__( universe_domain_opt, self._universe_domain_env ) ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1151,6 +1156,103 @@ def sample_async_query_reasoning_engine(): # Done; return the response. return response + def cancel_async_query_reasoning_engine( + self, + request: Optional[ + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Cancels an AsyncQueryReasoningEngine operation. + + .. 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 aiplatform_v1beta1 + + def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineExecutionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineRequest, dict]): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + ): + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.cancel_async_query_reasoning_engine + ] + + # 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),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self) -> "ReasoningEngineExecutionServiceClient": return self @@ -1166,7 +1268,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1192,8 +1294,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1202,7 +1308,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1211,7 +1317,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1225,7 +1331,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1251,8 +1357,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1261,7 +1371,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1270,7 +1380,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1284,7 +1394,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1314,8 +1424,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1324,7 +1438,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1332,7 +1446,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1340,7 +1454,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1369,8 +1483,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1379,7 +1497,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1387,7 +1505,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1395,7 +1513,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1427,8 +1545,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1437,7 +1559,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1446,7 +1568,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1460,7 +1582,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1552,8 +1674,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1562,7 +1688,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1571,7 +1699,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1585,7 +1713,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1678,8 +1806,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1688,7 +1820,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1697,7 +1831,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1711,7 +1845,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1742,8 +1876,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1752,7 +1890,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1761,7 +1901,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1775,7 +1915,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1801,8 +1941,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1811,7 +1955,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1820,7 +1964,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1834,7 +1978,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1860,8 +2004,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1870,7 +2018,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1879,7 +2027,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/README.rst index c17f0842b0..06363a9c8b 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ReasoningEngineExecutionServiceTransport` is the ABC for all transports. -- public child `ReasoningEngineExecutionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ReasoningEngineExecutionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseReasoningEngineExecutionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ReasoningEngineExecutionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ReasoningEngineExecutionServiceTransport`` is the ABC for all transports. + +- public child ``ReasoningEngineExecutionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ReasoningEngineExecutionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseReasoningEngineExecutionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ReasoningEngineExecutionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/__init__.py index 8d2c6f6d5a..2e0a97b929 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/base.py index c9ac9c62bf..a01c0b40df 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host @@ -158,6 +164,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: gapic_v1.method.wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: gapic_v1.method.wrap_method( self.get_location, default_timeout=None, @@ -254,6 +265,20 @@ def async_query_reasoning_engine( ]: raise NotImplementedError() + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + Union[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Awaitable[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse + ], + ], + ]: + raise NotImplementedError() + @property def list_operations( self, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py index 36c16e5125..3bd98273d8 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -193,6 +193,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -438,6 +442,38 @@ def async_query_reasoning_engine( ) return self._stubs["async_query_reasoning_engine"] + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + r"""Return a callable for the cancel async query reasoning + engine method over gRPC. + + Cancels an AsyncQueryReasoningEngine operation. + + Returns: + Callable[[~.CancelAsyncQueryReasoningEngineRequest], + ~.CancelAsyncQueryReasoningEngineResponse]: + 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 "cancel_async_query_reasoning_engine" not in self._stubs: + self._stubs["cancel_async_query_reasoning_engine"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/CancelAsyncQueryReasoningEngine", + request_serializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.serialize, + response_deserializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.deserialize, + ) + ) + return self._stubs["cancel_async_query_reasoning_engine"] + def close(self): self._logged_channel.close() diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py index ba885de8de..c66d5a4097 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -244,6 +244,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -446,6 +450,40 @@ def async_query_reasoning_engine( ) return self._stubs["async_query_reasoning_engine"] + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + Awaitable[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse + ], + ]: + r"""Return a callable for the cancel async query reasoning + engine method over gRPC. + + Cancels an AsyncQueryReasoningEngine operation. + + Returns: + Callable[[~.CancelAsyncQueryReasoningEngineRequest], + Awaitable[~.CancelAsyncQueryReasoningEngineResponse]]: + 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 "cancel_async_query_reasoning_engine" not in self._stubs: + self._stubs["cancel_async_query_reasoning_engine"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/CancelAsyncQueryReasoningEngine", + request_serializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.serialize, + response_deserializer=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.deserialize, + ) + ) + return self._stubs["cancel_async_query_reasoning_engine"] + def _prep_wrapped_messages(self, client_info): """Precompute the wrapped methods, overriding the base class method to use async wrappers.""" self._wrapped_methods = { @@ -464,6 +502,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: self._wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: self._wrap_method( self.get_location, default_timeout=None, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py index 715ca2ec2d..87554ecf85 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,6 +92,14 @@ def post_async_query_reasoning_engine(self, response): logging.log(f"Received response: {response}") return response + def pre_cancel_async_query_reasoning_engine(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_cancel_async_query_reasoning_engine(self, response): + logging.log(f"Received response: {response}") + return response + def pre_query_reasoning_engine(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -163,6 +171,59 @@ def post_async_query_reasoning_engine_with_metadata( """ return response, metadata + def pre_cancel_async_query_reasoning_engine( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineExecutionService server. + """ + return request, metadata + + def post_cancel_async_query_reasoning_engine( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + DEPRECATED. Please use the `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineExecutionService server but before + it is returned to user code. This `post_cancel_async_query_reasoning_engine` interceptor runs + before the `post_cancel_async_query_reasoning_engine_with_metadata` interceptor. + """ + return response + + def post_cancel_async_query_reasoning_engine_with_metadata( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineExecutionService server but before it is returned to user code. + + We recommend only using this `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor in new development instead of the `post_cancel_async_query_reasoning_engine` interceptor. + When both interceptors are used, this `post_cancel_async_query_reasoning_engine_with_metadata` interceptor runs after the + `post_cancel_async_query_reasoning_engine` interceptor. The (possibly modified) response returned by + `post_cancel_async_query_reasoning_engine` will be passed to + `post_cancel_async_query_reasoning_engine_with_metadata`. + """ + return response, metadata + def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, @@ -578,6 +639,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ReasoningEngineExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -981,6 +1048,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1383,6 +1454,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1833,6 +1908,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2279,6 +2358,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2725,6 +2808,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", @@ -2967,6 +3054,176 @@ def __call__( ) return resp + class _CancelAsyncQueryReasoningEngine( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine, + ReasoningEngineExecutionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineExecutionServiceRestTransport.CancelAsyncQueryReasoningEngine" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Call the cancel async query + reasoning engine method over HTTP. + + Args: + request (~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + http_options = ( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_http_options() + ) + + request, metadata = ( + self._interceptor.pre_cancel_async_query_reasoning_engine( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.CancelAsyncQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineExecutionServiceRestTransport._CancelAsyncQueryReasoningEngine._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + pb_resp = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + resp + ) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_cancel_async_query_reasoning_engine(resp) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + self._interceptor.post_cancel_async_query_reasoning_engine_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.cancel_async_query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + class _QueryReasoningEngine( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine, ReasoningEngineExecutionServiceRestStub, @@ -3343,6 +3600,17 @@ def async_query_reasoning_engine( # In C++ this would require a dynamic_cast return self._AsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CancelAsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property def query_reasoning_engine( self, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py index 4beffc63db..3f80307c75 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -109,6 +109,14 @@ async def post_async_query_reasoning_engine(self, response): logging.log(f"Received response: {response}") return response + async def pre_cancel_async_query_reasoning_engine(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + async def post_cancel_async_query_reasoning_engine(self, response): + logging.log(f"Received response: {response}") + return response + async def pre_query_reasoning_engine(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -180,6 +188,59 @@ async def post_async_query_reasoning_engine_with_metadata( """ return response, metadata + async def pre_cancel_async_query_reasoning_engine( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineExecutionService server. + """ + return request, metadata + + async def post_cancel_async_query_reasoning_engine( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + DEPRECATED. Please use the `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineExecutionService server but before + it is returned to user code. This `post_cancel_async_query_reasoning_engine` interceptor runs + before the `post_cancel_async_query_reasoning_engine_with_metadata` interceptor. + """ + return response + + async def post_cancel_async_query_reasoning_engine_with_metadata( + self, + response: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for cancel_async_query_reasoning_engine + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineExecutionService server but before it is returned to user code. + + We recommend only using this `post_cancel_async_query_reasoning_engine_with_metadata` + interceptor in new development instead of the `post_cancel_async_query_reasoning_engine` interceptor. + When both interceptors are used, this `post_cancel_async_query_reasoning_engine_with_metadata` interceptor runs after the + `post_cancel_async_query_reasoning_engine` interceptor. The (possibly modified) response returned by + `post_cancel_async_query_reasoning_engine` will be passed to + `post_cancel_async_query_reasoning_engine_with_metadata`. + """ + return response, metadata + async def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, @@ -582,6 +643,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncReasoningEngineExecutionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -620,6 +683,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.cancel_async_query_reasoning_engine: self._wrap_method( + self.cancel_async_query_reasoning_engine, + default_timeout=None, + client_info=client_info, + ), self.get_location: self._wrap_method( self.get_location, default_timeout=None, @@ -848,6 +916,184 @@ async def __call__( return resp + class _CancelAsyncQueryReasoningEngine( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine, + AsyncReasoningEngineExecutionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineExecutionServiceRestTransport.CancelAsyncQueryReasoningEngine" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + async def __call__( + self, + request: reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + r"""Call the cancel async query + reasoning engine method over HTTP. + + Args: + request (~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest): + The request object. Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse: + Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + http_options = ( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_http_options() + ) + + request, metadata = ( + await self._interceptor.pre_cancel_async_query_reasoning_engine( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.CancelAsyncQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineExecutionServiceRestTransport._CancelAsyncQueryReasoningEngine._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + # Return the response + resp = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + pb_resp = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + resp + ) + content = await response.read() + json_format.Parse(content, pb_resp, ignore_unknown_fields=True) + resp = await self._interceptor.post_cancel_async_query_reasoning_engine( + resp + ) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + await self._interceptor.post_cancel_async_query_reasoning_engine_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.cancel_async_query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelAsyncQueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + + return resp + class _QueryReasoningEngine( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine, AsyncReasoningEngineExecutionServiceRestStub, @@ -1607,6 +1853,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2009,6 +2259,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2459,6 +2713,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2905,6 +3163,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3351,6 +3613,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", @@ -3442,6 +3708,15 @@ def async_query_reasoning_engine( ]: return self._AsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property + def cancel_async_query_reasoning_engine( + self, + ) -> Callable[ + [reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest], + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ]: + return self._CancelAsyncQueryReasoningEngine(self._session, self._host, self._interceptor) # type: ignore + @property def query_reasoning_engine( self, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py index 0684bac86e..565b6cca09 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -162,6 +162,70 @@ def _get_query_params_json(transcoded_request): query_params["$alt"] = "json;enum-encoding=int" return query_params + class _BaseCancelAsyncQueryReasoningEngine: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}:cancelAsyncQuery", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{name=reasoningEngines/*}:cancelAsyncQuery", + "body": "*", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], use_integers_for_enums=True + ) + return body + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + use_integers_for_enums=True, + ) + ) + query_params.update( + _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelAsyncQueryReasoningEngine._get_unset_required_fields( + query_params + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + class _BaseQueryReasoningEngine: def __hash__(self): # pragma: NO COVER return NotImplementedError("__hash__ must be implemented.") @@ -184,6 +248,11 @@ def _get_http_options(): "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}:query", "body": "*", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}:query", + "body": "*", + }, { "method": "post", "uri": "/v1beta1/{name=reasoningEngines/*}:query", @@ -250,6 +319,11 @@ def _get_http_options(): "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}:streamQuery", "body": "*", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}:streamQuery", + "body": "*", + }, { "method": "post", "uri": "/v1beta1/{name=reasoningEngines/*}:streamQuery", @@ -1023,6 +1097,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1444,6 +1522,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1913,6 +1995,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2378,6 +2464,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2843,6 +2933,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/__init__.py new file mode 100644 index 0000000000..7d8e3ea240 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ReasoningEngineRuntimeRevisionServiceClient +from .async_client import ReasoningEngineRuntimeRevisionServiceAsyncClient + +__all__ = ( + "ReasoningEngineRuntimeRevisionServiceClient", + "ReasoningEngineRuntimeRevisionServiceAsyncClient", +) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/async_client.py new file mode 100644 index 0000000000..7d825c5d5d --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/async_client.py @@ -0,0 +1,1522 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging as std_logging +from collections import OrderedDict +import re +from typing import ( + Dict, + Callable, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +from google.cloud.aiplatform_v1beta1 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_async as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore +import google.protobuf + + +try: + OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore + +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + pagers, +) +from google.cloud.aiplatform_v1beta1.types import reasoning_engine +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore +import google.api_core.operation as operation # type: ignore +import google.api_core.operation_async as operation_async # type: ignore +import google.protobuf.empty_pb2 as empty_pb2 # type: ignore +import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore +from .transports.base import ( + ReasoningEngineRuntimeRevisionServiceTransport, + DEFAULT_CLIENT_INFO, +) +from .transports.grpc_asyncio import ( + ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, +) +from .client import ReasoningEngineRuntimeRevisionServiceClient + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class ReasoningEngineRuntimeRevisionServiceAsyncClient: + """Manages Vertex AI's Reasoning Engine Revisions.""" + + _client: ReasoningEngineRuntimeRevisionServiceClient + + # Copy defaults from the synchronous client for use here. + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ( + ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_MTLS_ENDPOINT + ) + _DEFAULT_ENDPOINT_TEMPLATE = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE + ) + _DEFAULT_UNIVERSE = ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + + git_repository_link_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.git_repository_link_path + ) + parse_git_repository_link_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_git_repository_link_path + ) + network_attachment_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.network_attachment_path + ) + parse_network_attachment_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_network_attachment_path + ) + reasoning_engine_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_path + ) + parse_reasoning_engine_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_reasoning_engine_path + ) + reasoning_engine_runtime_revision_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_runtime_revision_path + ) + parse_reasoning_engine_runtime_revision_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_reasoning_engine_runtime_revision_path + ) + common_billing_account_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_common_billing_account_path + ) + common_folder_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.common_folder_path + ) + parse_common_folder_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_common_folder_path + ) + common_organization_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_common_organization_path + ) + common_project_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.common_project_path + ) + parse_common_project_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.parse_common_project_path + ) + common_location_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.common_location_path + ) + parse_common_location_path = staticmethod( + ReasoningEngineRuntimeRevisionServiceClient.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: + ReasoningEngineRuntimeRevisionServiceAsyncClient: The constructed client. + """ + sa_info_func = ( + ReasoningEngineRuntimeRevisionServiceClient.from_service_account_info.__func__ # type: ignore + ) + return sa_info_func( + ReasoningEngineRuntimeRevisionServiceAsyncClient, info, *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: + ReasoningEngineRuntimeRevisionServiceAsyncClient: The constructed client. + """ + sa_file_func = ( + ReasoningEngineRuntimeRevisionServiceClient.from_service_account_file.__func__ # type: ignore + ) + return sa_file_func( + ReasoningEngineRuntimeRevisionServiceAsyncClient, filename, *args, **kwargs + ) + + 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 ReasoningEngineRuntimeRevisionServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> ReasoningEngineRuntimeRevisionServiceTransport: + """Returns the transport used by the client instance. + + Returns: + ReasoningEngineRuntimeRevisionServiceTransport: The transport used by the client instance. + """ + return self._client.transport + + @property + def api_endpoint(self) -> str: + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._client._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used + by the client instance. + """ + return self._client._universe_domain + + get_transport_class = ( + ReasoningEngineRuntimeRevisionServiceClient.get_transport_class + ) + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[ + Union[ + str, + ReasoningEngineRuntimeRevisionServiceTransport, + Callable[..., ReasoningEngineRuntimeRevisionServiceTransport], + ] + ] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the reasoning engine runtime revision service async 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 (Optional[Union[str,ReasoningEngineRuntimeRevisionServiceTransport,Callable[..., ReasoningEngineRuntimeRevisionServiceTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport to use. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ReasoningEngineRuntimeRevisionServiceTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient`.", + extra=( + { + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "credentialsType": None, + } + ), + ) + + async def get_reasoning_engine_runtime_revision( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + dict, + ] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + r"""Gets a reasoning engine runtime revision. + + .. 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 aiplatform_v1beta1 + + async def sample_get_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_reasoning_engine_runtime_revision(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.aiplatform_v1beta1.types.GetReasoningEngineRuntimeRevisionRequest, dict]]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision]. + name (:class:`str`): + Required. The name of the ReasoningEngineRuntimeRevision + resource. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtimeRevision}`` + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision: + ReasoningEngineRuntimeRevision is a + specific version of the runtime related + part of ReasoningEngine. Contains only + the fields that are revision specific. + + """ + # 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. + flattened_params = [name] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + ): + request = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest( + 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._client._transport._wrapped_methods[ + self._client._transport.get_reasoning_engine_runtime_revision + ] + + # 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),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_reasoning_engine_runtime_revisions( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + dict, + ] + ] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListReasoningEngineRuntimeRevisionsAsyncPager: + r"""Lists runtime revisions in a reasoning engine. + + .. 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 aiplatform_v1beta1 + + async def sample_list_reasoning_engine_runtime_revisions(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reasoning_engine_runtime_revisions(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest, dict]]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions]. + parent (:class:`str`): + Required. The resource name of the ReasoningEngine to + list the ReasoningEngineRuntimeRevisions from. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`` + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.pagers.ListReasoningEngineRuntimeRevisionsAsyncPager: + Response message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions] + + 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. + flattened_params = [parent] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + ): + request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + 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._client._transport._wrapped_methods[ + self._client._transport.list_reasoning_engine_runtime_revisions + ] + + # 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),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # 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.ListReasoningEngineRuntimeRevisionsAsyncPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_reasoning_engine_runtime_revision( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + dict, + ] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a reasoning engine revision. + + .. 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 aiplatform_v1beta1 + + async def sample_delete_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + operation = await client.delete_reasoning_engine_runtime_revision(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.aiplatform_v1beta1.types.DeleteReasoningEngineRuntimeRevisionRequest, dict]]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision]. + name (:class:`str`): + Required. The name of the ReasoningEngineRuntimeRevision + resource to be deleted. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}`` + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + 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. + flattened_params = [name] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + ): + request = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest( + 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._client._transport._wrapped_methods[ + self._client._transport.delete_reasoning_engine_runtime_revision + ] + + # 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),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # 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=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionOperationMetadata, + ) + + # Done; return the response. + return response + + async def list_operations( + self, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.list_operations] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_operation( + self, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.get_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_operation( + self, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.delete_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def cancel_operation( + self, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def wait_operation( + self, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Waits until the specified long-running operation is done or reaches at most + a specified timeout, returning the latest state. + + If the operation is already done, the latest state is immediately returned. + If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + timeout is used. If the server does not support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.WaitOperationRequest`): + The request object. Request message for + `WaitOperation` method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.wait_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_iam_policy( + self, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Sets the IAM access control policy on the specified function. + + Replaces any existing policy. + + Args: + request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): + The request object. Request message for `SetIamPolicy` + method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # 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 request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_iam_policy( + self, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM access control policy for a function. + + Returns an empty policy if the function exists and does not have a + policy set. + + Args: + request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): + The request object. Request message for `GetIamPolicy` + method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if + any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # 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 request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def test_iam_permissions( + self, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests the specified IAM permissions against the IAM access control + policy for a function. + + If the function does not exist, this will return an empty set + of permissions, not a NOT_FOUND error. + + Args: + request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): + The request object. Request message for + `TestIamPermissions` method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.iam_policy_pb2.TestIamPermissionsResponse: + Response message for ``TestIamPermissions`` 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 request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[ + self._client._transport.test_iam_permissions + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_location( + self, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.get_location] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_locations( + self, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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_async.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self.transport._wrapped_methods[self._client._transport.list_locations] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self) -> "ReasoningEngineRuntimeRevisionServiceAsyncClient": + 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__ +) + +if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER + DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ + + +__all__ = ("ReasoningEngineRuntimeRevisionServiceAsyncClient",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/client.py new file mode 100644 index 0000000000..ce611a3d73 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/client.py @@ -0,0 +1,2095 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 http import HTTPStatus +import json +import logging as std_logging +import os +import re +from typing import ( + Dict, + Callable, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) +import warnings + +from google.cloud.aiplatform_v1beta1 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 +import google.protobuf + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + pagers, +) +from google.cloud.aiplatform_v1beta1.types import reasoning_engine +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore +import google.api_core.operation as operation # type: ignore +import google.api_core.operation_async as operation_async # type: ignore +import google.protobuf.empty_pb2 as empty_pb2 # type: ignore +import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore +from .transports.base import ( + ReasoningEngineRuntimeRevisionServiceTransport, + DEFAULT_CLIENT_INFO, +) +from .transports.grpc import ReasoningEngineRuntimeRevisionServiceGrpcTransport +from .transports.grpc_asyncio import ( + ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, +) +from .transports.rest import ReasoningEngineRuntimeRevisionServiceRestTransport + +ASYNC_REST_EXCEPTION = None +try: + from .transports.rest_asyncio import ( + AsyncReasoningEngineRuntimeRevisionServiceRestTransport, + ) + + HAS_ASYNC_REST_DEPENDENCIES = True +except ImportError as e: # pragma: NO COVER + HAS_ASYNC_REST_DEPENDENCIES = False + ASYNC_REST_EXCEPTION = e + + +class ReasoningEngineRuntimeRevisionServiceClientMeta(type): + """Metaclass for the ReasoningEngineRuntimeRevisionService 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[ReasoningEngineRuntimeRevisionServiceTransport]] + _transport_registry["grpc"] = ReasoningEngineRuntimeRevisionServiceGrpcTransport + _transport_registry["grpc_asyncio"] = ( + ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport + ) + _transport_registry["rest"] = ReasoningEngineRuntimeRevisionServiceRestTransport + if HAS_ASYNC_REST_DEPENDENCIES: # pragma: NO COVER + _transport_registry["rest_asyncio"] = ( + AsyncReasoningEngineRuntimeRevisionServiceRestTransport + ) + + def get_transport_class( + cls, + label: Optional[str] = None, + ) -> Type[ReasoningEngineRuntimeRevisionServiceTransport]: + """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 == "rest_asyncio" and not HAS_ASYNC_REST_DEPENDENCIES + ): # pragma: NO COVER + raise ASYNC_REST_EXCEPTION + 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 ReasoningEngineRuntimeRevisionServiceClient( + metaclass=ReasoningEngineRuntimeRevisionServiceClientMeta +): + """Manages Vertex AI's Reasoning Engine Revisions.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: + """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: + Optional[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) + if m is None: + # Could not parse api_endpoint; return as-is. + return 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") + + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = "aiplatform.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + _DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.{UNIVERSE_DOMAIN}" + _DEFAULT_UNIVERSE = "googleapis.com" + + @staticmethod + def _use_client_cert_effective(): + """Returns whether client certificate should be used for mTLS if the + google-auth version supports should_use_client_cert automatic mTLS enablement. + + Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var. + + Returns: + bool: whether client certificate should be used for mTLS + Raises: + ValueError: (If using a version of google-auth without should_use_client_cert and + GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.) + """ + # check if google-auth version supports should_use_client_cert for automatic mTLS enablement + if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER + return mtls.should_use_client_cert() + else: # pragma: NO COVER + # if unsupported, fallback to reading from env var + use_client_cert_str = os.getenv( + "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" + ).lower() + if use_client_cert_str not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be" + " either `true` or `false`" + ) + return use_client_cert_str == "true" + + @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: + ReasoningEngineRuntimeRevisionServiceClient: 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: + ReasoningEngineRuntimeRevisionServiceClient: 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) -> ReasoningEngineRuntimeRevisionServiceTransport: + """Returns the transport used by the client instance. + + Returns: + ReasoningEngineRuntimeRevisionServiceTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def git_repository_link_path( + project: str, + location: str, + connection: str, + git_repository_link: str, + ) -> str: + """Returns a fully-qualified git_repository_link string.""" + return "projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{git_repository_link}".format( + project=project, + location=location, + connection=connection, + git_repository_link=git_repository_link, + ) + + @staticmethod + def parse_git_repository_link_path(path: str) -> Dict[str, str]: + """Parses a git_repository_link path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/connections/(?P.+?)/gitRepositoryLinks/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def network_attachment_path( + project: str, + region: str, + networkattachment: str, + ) -> str: + """Returns a fully-qualified network_attachment string.""" + return "projects/{project}/regions/{region}/networkAttachments/{networkattachment}".format( + project=project, + region=region, + networkattachment=networkattachment, + ) + + @staticmethod + def parse_network_attachment_path(path: str) -> Dict[str, str]: + """Parses a network_attachment path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/regions/(?P.+?)/networkAttachments/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def reasoning_engine_path( + project: str, + location: str, + reasoning_engine: str, + ) -> str: + """Returns a fully-qualified reasoning_engine string.""" + return "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + ) + + @staticmethod + def parse_reasoning_engine_path(path: str) -> Dict[str, str]: + """Parses a reasoning_engine path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/reasoningEngines/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def reasoning_engine_runtime_revision_path( + project: str, + location: str, + reasoning_engine: str, + runtime_revision: str, + ) -> str: + """Returns a fully-qualified reasoning_engine_runtime_revision string.""" + return "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + runtime_revision=runtime_revision, + ) + + @staticmethod + def parse_reasoning_engine_runtime_revision_path(path: str) -> Dict[str, str]: + """Parses a reasoning_engine_runtime_revision path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/reasoningEngines/(?P.+?)/runtimeRevisions/(?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 + ): + """Deprecated. 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. + """ + + warnings.warn( + "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.", + DeprecationWarning, + ) + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + ) + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + 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: + 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 + + @staticmethod + def _read_environment_variables(): + """Returns the environment variables used by the client. + + Returns: + Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE, + GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables. + + Raises: + ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not + any of ["true", "false"]. + google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT + is not any of ["auto", "never", "always"]. + """ + use_client_cert = ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + ) + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower() + universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + return use_client_cert, use_mtls_endpoint, universe_domain_env + + @staticmethod + def _get_client_cert_source(provided_cert_source, use_cert_flag): + """Return the client cert source to be used by the client. + + Args: + provided_cert_source (bytes): The client certificate source provided. + use_cert_flag (bool): A flag indicating whether to use the client certificate. + + Returns: + bytes or None: The client cert source to be used by the client. + """ + client_cert_source = None + if use_cert_flag: + if provided_cert_source: + client_cert_source = provided_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + return client_cert_source + + @staticmethod + def _get_api_endpoint( + api_override, client_cert_source, universe_domain, use_mtls_endpoint + ) -> str: + """Return the API endpoint used by the client. + + Args: + api_override (str): The API endpoint override. If specified, this is always + the return value of this function and the other arguments are not used. + client_cert_source (bytes): The client certificate source used by the client. + universe_domain (str): The universe domain used by the client. + use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters. + Possible values are "always", "auto", or "never". + + Returns: + str: The API endpoint to be used by the client. + """ + if api_override is not None: + api_endpoint = api_override + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + _default_universe = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + ) + if universe_domain != _default_universe: + raise MutualTLSChannelError( + f"mTLS is not supported in any universe other than {_default_universe}." + ) + api_endpoint = ( + ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_MTLS_ENDPOINT + ) + else: + api_endpoint = ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format( + UNIVERSE_DOMAIN=universe_domain + ) + return api_endpoint + + @staticmethod + def _get_universe_domain( + client_universe_domain: Optional[str], universe_domain_env: Optional[str] + ) -> str: + """Return the universe domain used by the client. + + Args: + client_universe_domain (Optional[str]): The universe domain configured via the client options. + universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable. + + Returns: + str: The universe domain to be used by the client. + + Raises: + ValueError: If the universe domain is an empty string. + """ + universe_domain = ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + if client_universe_domain is not None: + universe_domain = client_universe_domain + elif universe_domain_env is not None: + universe_domain = universe_domain_env + if len(universe_domain.strip()) == 0: + raise ValueError("Universe Domain cannot be an empty string.") + return universe_domain + + def _validate_universe_domain(self): + """Validates client's and credentials' universe domains are consistent. + + Returns: + bool: True iff the configured universe domain is valid. + + Raises: + ValueError: If the configured universe domain is not valid. + """ + + # NOTE (b/349488459): universe validation is disabled until further notice. + return True + + def _add_cred_info_for_auth_errors( + self, error: core_exceptions.GoogleAPICallError + ) -> None: + """Adds credential info string to error details for 401/403/404 errors. + + Args: + error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info. + """ + if error.code not in [ + HTTPStatus.UNAUTHORIZED, + HTTPStatus.FORBIDDEN, + HTTPStatus.NOT_FOUND, + ]: + return + + cred = self._transport._credentials + + # get_cred_info is only available in google-auth>=2.35.0 + if not hasattr(cred, "get_cred_info"): + return + + # ignore the type check since pypy test fails when get_cred_info + # is not available + cred_info = cred.get_cred_info() # type: ignore + if cred_info and hasattr(error._details, "append"): + error._details.append(json.dumps(cred_info)) + + @property + def api_endpoint(self) -> str: + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used by the client instance. + """ + return self._universe_domain + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[ + Union[ + str, + ReasoningEngineRuntimeRevisionServiceTransport, + Callable[..., ReasoningEngineRuntimeRevisionServiceTransport], + ] + ] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the reasoning engine runtime revision service 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 (Optional[Union[str,ReasoningEngineRuntimeRevisionServiceTransport,Callable[..., ReasoningEngineRuntimeRevisionServiceTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ReasoningEngineRuntimeRevisionServiceTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that the ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client_options = client_options + if isinstance(self._client_options, dict): + self._client_options = client_options_lib.from_dict(self._client_options) + if self._client_options is None: + self._client_options = client_options_lib.ClientOptions() + self._client_options = cast( + client_options_lib.ClientOptions, self._client_options + ) + + universe_domain_opt = getattr(self._client_options, "universe_domain", None) + + self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + ) + self._client_cert_source = ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source( + self._client_options.client_cert_source, self._use_client_cert + ) + ) + self._universe_domain = ( + ReasoningEngineRuntimeRevisionServiceClient._get_universe_domain( + universe_domain_opt, self._universe_domain_env + ) + ) + self._api_endpoint: str = "" # updated below, depending on `transport` + + # Initialize the universe domain validation. + self._is_universe_domain_valid = False + + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + + api_key_value = getattr(self._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. + transport_provided = isinstance( + transport, ReasoningEngineRuntimeRevisionServiceTransport + ) + if transport_provided: + # transport is a ReasoningEngineRuntimeRevisionServiceTransport instance. + if credentials or self._client_options.credentials_file or api_key_value: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if self._client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = cast( + ReasoningEngineRuntimeRevisionServiceTransport, transport + ) + self._api_endpoint = self._transport.host + + self._api_endpoint = ( + self._api_endpoint + or ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + self._client_options.api_endpoint, + self._client_cert_source, + self._universe_domain, + self._use_mtls_endpoint, + ) + ) + + if not transport_provided: + transport_init: Union[ + Type[ReasoningEngineRuntimeRevisionServiceTransport], + Callable[..., ReasoningEngineRuntimeRevisionServiceTransport], + ] = ( + ReasoningEngineRuntimeRevisionServiceClient.get_transport_class( + transport + ) + if isinstance(transport, str) or transport is None + else cast( + Callable[..., ReasoningEngineRuntimeRevisionServiceTransport], + transport, + ) + ) + + if "rest_asyncio" in str(transport_init): + unsupported_params = { + "google.api_core.client_options.ClientOptions.credentials_file": self._client_options.credentials_file, + "google.api_core.client_options.ClientOptions.scopes": self._client_options.scopes, + "google.api_core.client_options.ClientOptions.quota_project_id": self._client_options.quota_project_id, + "google.api_core.client_options.ClientOptions.client_cert_source": self._client_options.client_cert_source, + "google.api_core.client_options.ClientOptions.api_audience": self._client_options.api_audience, + } + provided_unsupported_params = [ + name + for name, value in unsupported_params.items() + if value is not None + ] + if provided_unsupported_params: + raise core_exceptions.AsyncRestUnsupportedParameterError( # type: ignore + f"The following provided parameters are not supported for `transport=rest_asyncio`: {', '.join(provided_unsupported_params)}" + ) + self._transport = transport_init( + credentials=credentials, + host=self._api_endpoint, + client_info=client_info, + ) + return + + 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 + ) + + # initialize with the provided callable or the passed in class + self._transport = transport_init( + credentials=credentials, + credentials_file=self._client_options.credentials_file, + host=self._api_endpoint, + scopes=self._client_options.scopes, + client_cert_source_for_mtls=self._client_cert_source, + quota_project_id=self._client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=self._client_options.api_audience, + ) + + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient`.", + extra=( + { + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, + "get_cred_info", + lambda: None, + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "credentialsType": None, + } + ), + ) + + def get_reasoning_engine_runtime_revision( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + dict, + ] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + r"""Gets a reasoning engine runtime revision. + + .. 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 aiplatform_v1beta1 + + def sample_get_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + response = client.get_reasoning_engine_runtime_revision(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.aiplatform_v1beta1.types.GetReasoningEngineRuntimeRevisionRequest, dict]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision]. + name (str): + Required. The name of the ReasoningEngineRuntimeRevision + resource. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtimeRevision}`` + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision: + ReasoningEngineRuntimeRevision is a + specific version of the runtime related + part of ReasoningEngine. Contains only + the fields that are revision specific. + + """ + # 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. + flattened_params = [name] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + ): + request = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest( + 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_reasoning_engine_runtime_revision + ] + + # 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),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_reasoning_engine_runtime_revisions( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + dict, + ] + ] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListReasoningEngineRuntimeRevisionsPager: + r"""Lists runtime revisions in a reasoning engine. + + .. 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 aiplatform_v1beta1 + + def sample_list_reasoning_engine_runtime_revisions(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reasoning_engine_runtime_revisions(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest, dict]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions]. + parent (str): + Required. The resource name of the ReasoningEngine to + list the ReasoningEngineRuntimeRevisions from. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`` + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.pagers.ListReasoningEngineRuntimeRevisionsPager: + Response message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions] + + 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. + flattened_params = [parent] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + ): + request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + 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_reasoning_engine_runtime_revisions + ] + + # 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),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # 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.ListReasoningEngineRuntimeRevisionsPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_reasoning_engine_runtime_revision( + self, + request: Optional[ + Union[ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + dict, + ] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operation.Operation: + r"""Deletes a reasoning engine revision. + + .. 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 aiplatform_v1beta1 + + def sample_delete_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_reasoning_engine_runtime_revision(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.aiplatform_v1beta1.types.DeleteReasoningEngineRuntimeRevisionRequest, dict]): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision]. + name (str): + Required. The name of the ReasoningEngineRuntimeRevision + resource to be deleted. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}`` + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + 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. + flattened_params = [name] + has_flattened_params = ( + len([param for param in flattened_params if param is not None]) > 0 + ) + 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." + ) + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance( + request, + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + ): + request = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest( + 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_reasoning_engine_runtime_revision + ] + + # 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),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # 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=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionOperationMetadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "ReasoningEngineRuntimeRevisionServiceClient": + 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[Union[operations_pb2.ListOperationsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_operations] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def get_operation( + self, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def delete_operation( + self, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def cancel_operation( + self, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.cancel_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def wait_operation( + self, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Waits until the specified long-running operation is done or reaches at most + a specified timeout, returning the latest state. + + If the operation is already done, the latest state is immediately returned. + If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + timeout is used. If the server does not support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.WaitOperationRequest`): + The request object. Request message for + `WaitOperation` 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.wait_operation] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def set_iam_policy( + self, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Sets the IAM access control policy on the specified function. + + Replaces any existing policy. + + Args: + request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): + The request object. Request message for `SetIamPolicy` + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # 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 request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def get_iam_policy( + self, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM access control policy for a function. + + Returns an empty policy if the function exists and does not have a + policy set. + + Args: + request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): + The request object. Request message for `GetIamPolicy` + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # 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 request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def test_iam_permissions( + self, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests the specified IAM permissions against the IAM access control + policy for a function. + + If the function does not exist, this will return an empty set + of permissions, not a NOT_FOUND error. + + Args: + request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): + The request object. Request message for + `TestIamPermissions` 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + Returns: + ~.iam_policy_pb2.TestIamPermissionsResponse: + Response message for ``TestIamPermissions`` 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 request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def get_location( + self, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_location] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + def list_locations( + self, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + 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 request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_locations] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + try: + # Send the request. + response = rpc( + request_pb, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + except core_exceptions.GoogleAPICallError as e: + self._add_cred_info_for_auth_errors(e) + raise e + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) + +if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER + DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ + +__all__ = ("ReasoningEngineRuntimeRevisionServiceClient",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/pagers.py new file mode 100644 index 0000000000..6354d4aba8 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/pagers.py @@ -0,0 +1,225 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import retry_async as retries_async +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Sequence, + Tuple, + Optional, + Iterator, + Union, +) + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] + OptionalAsyncRetry = Union[ + retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None + ] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) + + +class ListReasoningEngineRuntimeRevisionsPager: + """A pager for iterating through ``list_reasoning_engine_runtime_revisions`` requests. + + This class thinly wraps an initial + :class:`google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``reasoning_engine_runtime_revisions`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListReasoningEngineRuntimeRevisions`` requests and continue to iterate + through the ``reasoning_engine_runtime_revisions`` field on the + corresponding responses. + + All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse` + 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[ + ..., + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ], + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest): + The initial request object. + response (google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse): + The initial response object. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + request + ) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages( + self, + ) -> Iterator[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method( + self._request, + retry=self._retry, + timeout=self._timeout, + metadata=self._metadata, + ) + yield self._response + + def __iter__( + self, + ) -> Iterator[reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision]: + for page in self.pages: + yield from page.reasoning_engine_runtime_revisions + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListReasoningEngineRuntimeRevisionsAsyncPager: + """A pager for iterating through ``list_reasoning_engine_runtime_revisions`` requests. + + This class thinly wraps an initial + :class:`google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``reasoning_engine_runtime_revisions`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListReasoningEngineRuntimeRevisions`` requests and continue to iterate + through the ``reasoning_engine_runtime_revisions`` field on the + corresponding responses. + + All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse` + 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[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ], + ], + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + *, + retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest): + The initial request object. + response (google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsResponse): + The initial response object. + retry (google.api_core.retry.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + request + ) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterator[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ]: + 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, + retry=self._retry, + timeout=self._timeout, + metadata=self._metadata, + ) + yield self._response + + def __aiter__( + self, + ) -> AsyncIterator[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ]: + async def async_generator(): + async for page in self.pages: + for response in page.reasoning_engine_runtime_revisions: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/README.rst new file mode 100644 index 0000000000..03d506c1ff --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/README.rst @@ -0,0 +1,10 @@ + +transport inheritance structure +_______________________________ + +``ReasoningEngineRuntimeRevisionServiceTransport`` is the ABC for all transports. + +- public child ``ReasoningEngineRuntimeRevisionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseReasoningEngineRuntimeRevisionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ReasoningEngineRuntimeRevisionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/__init__.py new file mode 100644 index 0000000000..5d17bd5780 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/__init__.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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, Tuple + +from .base import ReasoningEngineRuntimeRevisionServiceTransport +from .grpc import ReasoningEngineRuntimeRevisionServiceGrpcTransport +from .grpc_asyncio import ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport +from .rest import ReasoningEngineRuntimeRevisionServiceRestTransport +from .rest import ReasoningEngineRuntimeRevisionServiceRestInterceptor + +ASYNC_REST_CLASSES: Tuple[str, ...] +try: + from .rest_asyncio import AsyncReasoningEngineRuntimeRevisionServiceRestTransport + from .rest_asyncio import AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor + + ASYNC_REST_CLASSES = ( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport", + "AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor", + ) + HAS_REST_ASYNC = True +except ImportError: # pragma: NO COVER + ASYNC_REST_CLASSES = () + HAS_REST_ASYNC = False + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[ReasoningEngineRuntimeRevisionServiceTransport]] +_transport_registry["grpc"] = ReasoningEngineRuntimeRevisionServiceGrpcTransport +_transport_registry["grpc_asyncio"] = ( + ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport +) +_transport_registry["rest"] = ReasoningEngineRuntimeRevisionServiceRestTransport +if HAS_REST_ASYNC: # pragma: NO COVER + _transport_registry["rest_asyncio"] = ( + AsyncReasoningEngineRuntimeRevisionServiceRestTransport + ) + +__all__ = ( + "ReasoningEngineRuntimeRevisionServiceTransport", + "ReasoningEngineRuntimeRevisionServiceGrpcTransport", + "ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport", + "ReasoningEngineRuntimeRevisionServiceRestTransport", + "ReasoningEngineRuntimeRevisionServiceRestInterceptor", +) + ASYNC_REST_CLASSES diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/base.py new file mode 100644 index 0000000000..ca35462fe6 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/base.py @@ -0,0 +1,380 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.aiplatform_v1beta1 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 +import google.protobuf + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) + +if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER + DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ + + +class ReasoningEngineRuntimeRevisionServiceTransport(abc.ABC): + """Abstract transport class for ReasoningEngineRuntimeRevisionService.""" + + AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + + DEFAULT_HOST: str = "aiplatform.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 (default: 'aiplatform.googleapis.com'). + 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]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. This argument will be + removed in the next major version of this library. + 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. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. + """ + + # Save the scopes. + self._scopes = scopes + if not hasattr(self, "_ignore_credentials"): + self._ignore_credentials: bool = False + + # 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=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, + ) + elif credentials is None and not self._ignore_credentials: + credentials, _ = google.auth.default( + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, + ) + # 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 + + self._wrapped_methods: Dict[Callable, Callable] = {} + + @property + def host(self): + return self._host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.get_reasoning_engine_runtime_revision: gapic_v1.method.wrap_method( + self.get_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.list_reasoning_engine_runtime_revisions: gapic_v1.method.wrap_method( + self.list_reasoning_engine_runtime_revisions, + default_timeout=None, + client_info=client_info, + ), + self.delete_reasoning_engine_runtime_revision: gapic_v1.method.wrap_method( + self.delete_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.get_location: gapic_v1.method.wrap_method( + self.get_location, + default_timeout=None, + client_info=client_info, + ), + self.list_locations: gapic_v1.method.wrap_method( + self.list_locations, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: gapic_v1.method.wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: gapic_v1.method.wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: gapic_v1.method.wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + self.cancel_operation: gapic_v1.method.wrap_method( + self.cancel_operation, + default_timeout=None, + client_info=client_info, + ), + self.delete_operation: gapic_v1.method.wrap_method( + self.delete_operation, + default_timeout=None, + client_info=client_info, + ), + self.get_operation: gapic_v1.method.wrap_method( + self.get_operation, + default_timeout=None, + client_info=client_info, + ), + self.list_operations: gapic_v1.method.wrap_method( + self.list_operations, + default_timeout=None, + client_info=client_info, + ), + self.wait_operation: gapic_v1.method.wrap_method( + self.wait_operation, + default_timeout=None, + 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 get_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest + ], + Union[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + Awaitable[reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision], + ], + ]: + raise NotImplementedError() + + @property + def list_reasoning_engine_runtime_revisions( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest + ], + Union[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + Awaitable[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ], + ], + ]: + raise NotImplementedError() + + @property + def delete_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest + ], + 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 wait_operation( + self, + ) -> Callable[ + [operations_pb2.WaitOperationRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def set_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.SetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def get_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.GetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + Union[ + iam_policy_pb2.TestIamPermissionsResponse, + Awaitable[iam_policy_pb2.TestIamPermissionsResponse], + ], + ]: + 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__ = ("ReasoningEngineRuntimeRevisionServiceTransport",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc.py new file mode 100644 index 0000000000..8b1c8a269d --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc.py @@ -0,0 +1,669 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 json +import logging as std_logging +import pickle +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 +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore +from .base import ReasoningEngineRuntimeRevisionServiceTransport, DEFAULT_CLIENT_INFO + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ReasoningEngineRuntimeRevisionServiceGrpcTransport( + ReasoningEngineRuntimeRevisionServiceTransport +): + """gRPC backend transport for ReasoningEngineRuntimeRevisionService. + + Manages Vertex AI's Reasoning Engine Revisions. + + 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 = "aiplatform.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[grpc.Channel, Callable[..., 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 (default: 'aiplatform.googleapis.com'). + 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 a ``channel`` instance is provided. + credentials_file (Optional[str]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if a ``channel`` instance is provided. + This argument will be removed in the next major version of this library. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if a ``channel`` instance is provided. + channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. + + 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 isinstance(channel, grpc.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel( + cls, + host: str = "aiplatform.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]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. This argument will be + removed in the next major version of this library. + 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._logged_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def get_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest + ], + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + ]: + r"""Return a callable for the get reasoning engine runtime + revision method over gRPC. + + Gets a reasoning engine runtime revision. + + Returns: + Callable[[~.GetReasoningEngineRuntimeRevisionRequest], + ~.ReasoningEngineRuntimeRevision]: + 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_reasoning_engine_runtime_revision" not in self._stubs: + self._stubs["get_reasoning_engine_runtime_revision"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/GetReasoningEngineRuntimeRevision", + request_serializer=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest.serialize, + response_deserializer=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.deserialize, + ) + ) + return self._stubs["get_reasoning_engine_runtime_revision"] + + @property + def list_reasoning_engine_runtime_revisions( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest + ], + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ]: + r"""Return a callable for the list reasoning engine runtime + revisions method over gRPC. + + Lists runtime revisions in a reasoning engine. + + Returns: + Callable[[~.ListReasoningEngineRuntimeRevisionsRequest], + ~.ListReasoningEngineRuntimeRevisionsResponse]: + 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_reasoning_engine_runtime_revisions" not in self._stubs: + self._stubs["list_reasoning_engine_runtime_revisions"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/ListReasoningEngineRuntimeRevisions", + request_serializer=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest.serialize, + response_deserializer=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.deserialize, + ) + ) + return self._stubs["list_reasoning_engine_runtime_revisions"] + + @property + def delete_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest + ], + operations_pb2.Operation, + ]: + r"""Return a callable for the delete reasoning engine + runtime revision method over gRPC. + + Deletes a reasoning engine revision. + + Returns: + Callable[[~.DeleteReasoningEngineRuntimeRevisionRequest], + ~.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_reasoning_engine_runtime_revision" not in self._stubs: + self._stubs["delete_reasoning_engine_runtime_revision"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/DeleteReasoningEngineRuntimeRevision", + request_serializer=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + ) + return self._stubs["delete_reasoning_engine_runtime_revision"] + + def close(self): + self._logged_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._logged_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._logged_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def wait_operation( + self, + ) -> Callable[[operations_pb2.WaitOperationRequest], None]: + r"""Return a callable for the wait_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 "wait_operation" not in self._stubs: + self._stubs["wait_operation"] = self._logged_channel.unary_unary( + "/google.longrunning.Operations/WaitOperation", + request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["wait_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._logged_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._logged_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._logged_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._logged_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 set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the set iam policy method over gRPC. + Sets the IAM access control policy on the specified + function. Replaces any existing policy. + Returns: + Callable[[~.SetIamPolicyRequest], + ~.Policy]: + 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 "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the get iam policy method over gRPC. + Gets the IAM access control policy for a function. + Returns an empty policy if the function exists and does + not have a policy set. + Returns: + Callable[[~.GetIamPolicyRequest], + ~.Policy]: + 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_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + iam_policy_pb2.TestIamPermissionsResponse, + ]: + r"""Return a callable for the test iam permissions method over gRPC. + Tests the specified permissions against the IAM access control + policy for a function. If the function does not exist, this will + return an empty set of permissions, not a NOT_FOUND error. + Returns: + Callable[[~.TestIamPermissionsRequest], + ~.TestIamPermissionsResponse]: + 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 "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ("ReasoningEngineRuntimeRevisionServiceGrpcTransport",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc_asyncio.py new file mode 100644 index 0000000000..ea4ed203c4 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/grpc_asyncio.py @@ -0,0 +1,754 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 inspect +import json +import pickle +import logging as std_logging +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 exceptions as core_exceptions +from google.api_core import retry_async as retries +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 +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore +from .base import ReasoningEngineRuntimeRevisionServiceTransport, DEFAULT_CLIENT_INFO +from .grpc import ReasoningEngineRuntimeRevisionServiceGrpcTransport + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport( + ReasoningEngineRuntimeRevisionServiceTransport +): + """gRPC AsyncIO backend transport for ReasoningEngineRuntimeRevisionService. + + Manages Vertex AI's Reasoning Engine Revisions. + + 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 = "aiplatform.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]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be + removed in the next major version of this library. + 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 = "aiplatform.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[aio.Channel, Callable[..., 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 (default: 'aiplatform.googleapis.com'). + 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 a ``channel`` instance is provided. + credentials_file (Optional[str]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if a ``channel`` instance is provided. + This argument will be removed in the next major version of this library. + 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[Union[aio.Channel, Callable[..., aio.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. + + 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 isinstance(channel, aio.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel + self._wrap_with_kind = ( + "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters + ) + # Wrap messages. This must be done after self._logged_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._logged_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def get_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest + ], + Awaitable[reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision], + ]: + r"""Return a callable for the get reasoning engine runtime + revision method over gRPC. + + Gets a reasoning engine runtime revision. + + Returns: + Callable[[~.GetReasoningEngineRuntimeRevisionRequest], + Awaitable[~.ReasoningEngineRuntimeRevision]]: + 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_reasoning_engine_runtime_revision" not in self._stubs: + self._stubs["get_reasoning_engine_runtime_revision"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/GetReasoningEngineRuntimeRevision", + request_serializer=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest.serialize, + response_deserializer=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.deserialize, + ) + ) + return self._stubs["get_reasoning_engine_runtime_revision"] + + @property + def list_reasoning_engine_runtime_revisions( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest + ], + Awaitable[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ], + ]: + r"""Return a callable for the list reasoning engine runtime + revisions method over gRPC. + + Lists runtime revisions in a reasoning engine. + + Returns: + Callable[[~.ListReasoningEngineRuntimeRevisionsRequest], + Awaitable[~.ListReasoningEngineRuntimeRevisionsResponse]]: + 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_reasoning_engine_runtime_revisions" not in self._stubs: + self._stubs["list_reasoning_engine_runtime_revisions"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/ListReasoningEngineRuntimeRevisions", + request_serializer=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest.serialize, + response_deserializer=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.deserialize, + ) + ) + return self._stubs["list_reasoning_engine_runtime_revisions"] + + @property + def delete_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest + ], + Awaitable[operations_pb2.Operation], + ]: + r"""Return a callable for the delete reasoning engine + runtime revision method over gRPC. + + Deletes a reasoning engine revision. + + Returns: + Callable[[~.DeleteReasoningEngineRuntimeRevisionRequest], + 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_reasoning_engine_runtime_revision" not in self._stubs: + self._stubs["delete_reasoning_engine_runtime_revision"] = ( + self._logged_channel.unary_unary( + "/google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService/DeleteReasoningEngineRuntimeRevision", + request_serializer=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + ) + return self._stubs["delete_reasoning_engine_runtime_revision"] + + def _prep_wrapped_messages(self, client_info): + """Precompute the wrapped methods, overriding the base class method to use async wrappers.""" + self._wrapped_methods = { + self.get_reasoning_engine_runtime_revision: self._wrap_method( + self.get_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.list_reasoning_engine_runtime_revisions: self._wrap_method( + self.list_reasoning_engine_runtime_revisions, + default_timeout=None, + client_info=client_info, + ), + self.delete_reasoning_engine_runtime_revision: self._wrap_method( + self.delete_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.get_location: self._wrap_method( + self.get_location, + default_timeout=None, + client_info=client_info, + ), + self.list_locations: self._wrap_method( + self.list_locations, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: self._wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: self._wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: self._wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + self.cancel_operation: self._wrap_method( + self.cancel_operation, + default_timeout=None, + client_info=client_info, + ), + self.delete_operation: self._wrap_method( + self.delete_operation, + default_timeout=None, + client_info=client_info, + ), + self.get_operation: self._wrap_method( + self.get_operation, + default_timeout=None, + client_info=client_info, + ), + self.list_operations: self._wrap_method( + self.list_operations, + default_timeout=None, + client_info=client_info, + ), + self.wait_operation: self._wrap_method( + self.wait_operation, + default_timeout=None, + client_info=client_info, + ), + } + + def _wrap_method(self, func, *args, **kwargs): + if self._wrap_with_kind: # pragma: NO COVER + kwargs["kind"] = self.kind + return gapic_v1.method_async.wrap_method(func, *args, **kwargs) + + def close(self): + return self._logged_channel.close() + + @property + def kind(self) -> str: + return "grpc_asyncio" + + @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._logged_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._logged_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def wait_operation( + self, + ) -> Callable[[operations_pb2.WaitOperationRequest], None]: + r"""Return a callable for the wait_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 "wait_operation" not in self._stubs: + self._stubs["wait_operation"] = self._logged_channel.unary_unary( + "/google.longrunning.Operations/WaitOperation", + request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["wait_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._logged_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._logged_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._logged_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._logged_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 set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the set iam policy method over gRPC. + Sets the IAM access control policy on the specified + function. Replaces any existing policy. + Returns: + Callable[[~.SetIamPolicyRequest], + ~.Policy]: + 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 "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the get iam policy method over gRPC. + Gets the IAM access control policy for a function. + Returns an empty policy if the function exists and does + not have a policy set. + Returns: + Callable[[~.GetIamPolicyRequest], + ~.Policy]: + 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_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + iam_policy_pb2.TestIamPermissionsResponse, + ]: + r"""Return a callable for the test iam permissions method over gRPC. + Tests the specified permissions against the IAM access control + policy for a function. If the function does not exist, this will + return an empty set of permissions, not a NOT_FOUND error. + Returns: + Callable[[~.TestIamPermissionsRequest], + ~.TestIamPermissionsResponse]: + 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 "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( + "/google.iam.v1.IAMPolicy/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + +__all__ = ("ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest.py new file mode 100644 index 0000000000..3f3fb35438 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest.py @@ -0,0 +1,4789 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging +import json # type: ignore + +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import gapic_v1 +import google.protobuf + +from google.protobuf import json_format +from google.api_core import operations_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.cloud.location import locations_pb2 # type: ignore + +from requests import __version__ as requests_version +import dataclasses +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +from google.longrunning import operations_pb2 # type: ignore + + +from .rest_base import _BaseReasoningEngineRuntimeRevisionServiceRestTransport +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=f"requests@{requests_version}", +) + +if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER + DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ + + +class ReasoningEngineRuntimeRevisionServiceRestInterceptor: + """Interceptor for ReasoningEngineRuntimeRevisionService. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the ReasoningEngineRuntimeRevisionServiceRestTransport. + + .. code-block:: python + class MyCustomReasoningEngineRuntimeRevisionServiceInterceptor(ReasoningEngineRuntimeRevisionServiceRestInterceptor): + def pre_delete_reasoning_engine_runtime_revision(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_reasoning_engine_runtime_revision(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_reasoning_engine_runtime_revision(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_reasoning_engine_runtime_revision(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_reasoning_engine_runtime_revisions(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_reasoning_engine_runtime_revisions(self, response): + logging.log(f"Received response: {response}") + return response + + transport = ReasoningEngineRuntimeRevisionServiceRestTransport(interceptor=MyCustomReasoningEngineRuntimeRevisionServiceInterceptor()) + client = ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + + + """ + + def pre_delete_reasoning_engine_runtime_revision( + self, + request: reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for delete_reasoning_engine_runtime_revision + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_delete_reasoning_engine_runtime_revision( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_reasoning_engine_runtime_revision + + DEPRECATED. Please use the `post_delete_reasoning_engine_runtime_revision_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_delete_reasoning_engine_runtime_revision` interceptor runs + before the `post_delete_reasoning_engine_runtime_revision_with_metadata` interceptor. + """ + return response + + def post_delete_reasoning_engine_runtime_revision_with_metadata( + self, + response: operations_pb2.Operation, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]: + """Post-rpc interceptor for delete_reasoning_engine_runtime_revision + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_delete_reasoning_engine_runtime_revision_with_metadata` + interceptor in new development instead of the `post_delete_reasoning_engine_runtime_revision` interceptor. + When both interceptors are used, this `post_delete_reasoning_engine_runtime_revision_with_metadata` interceptor runs after the + `post_delete_reasoning_engine_runtime_revision` interceptor. The (possibly modified) response returned by + `post_delete_reasoning_engine_runtime_revision` will be passed to + `post_delete_reasoning_engine_runtime_revision_with_metadata`. + """ + return response, metadata + + def pre_get_reasoning_engine_runtime_revision( + self, + request: reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for get_reasoning_engine_runtime_revision + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_get_reasoning_engine_runtime_revision( + self, response: reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + """Post-rpc interceptor for get_reasoning_engine_runtime_revision + + DEPRECATED. Please use the `post_get_reasoning_engine_runtime_revision_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_get_reasoning_engine_runtime_revision` interceptor runs + before the `post_get_reasoning_engine_runtime_revision_with_metadata` interceptor. + """ + return response + + def post_get_reasoning_engine_runtime_revision_with_metadata( + self, + response: reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for get_reasoning_engine_runtime_revision + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_get_reasoning_engine_runtime_revision_with_metadata` + interceptor in new development instead of the `post_get_reasoning_engine_runtime_revision` interceptor. + When both interceptors are used, this `post_get_reasoning_engine_runtime_revision_with_metadata` interceptor runs after the + `post_get_reasoning_engine_runtime_revision` interceptor. The (possibly modified) response returned by + `post_get_reasoning_engine_runtime_revision` will be passed to + `post_get_reasoning_engine_runtime_revision_with_metadata`. + """ + return response, metadata + + def pre_list_reasoning_engine_runtime_revisions( + self, + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for list_reasoning_engine_runtime_revisions + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_list_reasoning_engine_runtime_revisions( + self, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ) -> ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ): + """Post-rpc interceptor for list_reasoning_engine_runtime_revisions + + DEPRECATED. Please use the `post_list_reasoning_engine_runtime_revisions_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_list_reasoning_engine_runtime_revisions` interceptor runs + before the `post_list_reasoning_engine_runtime_revisions_with_metadata` interceptor. + """ + return response + + def post_list_reasoning_engine_runtime_revisions_with_metadata( + self, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for list_reasoning_engine_runtime_revisions + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_list_reasoning_engine_runtime_revisions_with_metadata` + interceptor in new development instead of the `post_list_reasoning_engine_runtime_revisions` interceptor. + When both interceptors are used, this `post_list_reasoning_engine_runtime_revisions_with_metadata` interceptor runs after the + `post_list_reasoning_engine_runtime_revisions` interceptor. The (possibly modified) response returned by + `post_list_reasoning_engine_runtime_revisions` will be passed to + `post_list_reasoning_engine_runtime_revisions_with_metadata`. + """ + return response, metadata + + def pre_get_location( + self, + request: locations_pb2.GetLocationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_location + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_get_location( + self, response: locations_pb2.Location + ) -> locations_pb2.Location: + """Post-rpc interceptor for get_location + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_list_locations( + self, + request: locations_pb2.ListLocationsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for list_locations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_list_locations( + self, response: locations_pb2.ListLocationsResponse + ) -> locations_pb2.ListLocationsResponse: + """Post-rpc interceptor for list_locations + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_get_iam_policy( + self, + request: iam_policy_pb2.GetIamPolicyRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: + """Post-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_set_iam_policy( + self, + request: iam_policy_pb2.SetIamPolicyRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: + """Post-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_test_iam_permissions( + self, + request: iam_policy_pb2.TestIamPermissionsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_test_iam_permissions( + self, response: iam_policy_pb2.TestIamPermissionsResponse + ) -> iam_policy_pb2.TestIamPermissionsResponse: + """Post-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_cancel_operation( + self, + request: operations_pb2.CancelOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for cancel_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_cancel_operation(self, response: None) -> None: + """Post-rpc interceptor for cancel_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_delete_operation( + self, + request: operations_pb2.DeleteOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for delete_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_delete_operation(self, response: None) -> None: + """Post-rpc interceptor for delete_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_get_operation( + self, + request: operations_pb2.GetOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_get_operation( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for get_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_list_operations( + self, + request: operations_pb2.ListOperationsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for list_operations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_list_operations( + self, response: operations_pb2.ListOperationsResponse + ) -> operations_pb2.ListOperationsResponse: + """Post-rpc interceptor for list_operations + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + def pre_wait_operation( + self, + request: operations_pb2.WaitOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for wait_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + def post_wait_operation( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for wait_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class ReasoningEngineRuntimeRevisionServiceRestStub: + _session: AuthorizedSession + _host: str + _interceptor: ReasoningEngineRuntimeRevisionServiceRestInterceptor + + +class ReasoningEngineRuntimeRevisionServiceRestTransport( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport +): + """REST backend synchronous transport for ReasoningEngineRuntimeRevisionService. + + Manages Vertex AI's Reasoning Engine Revisions. + + 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 JSON representations of protocol buffers over HTTP/1.1 + """ + + def __init__( + self, + *, + host: str = "aiplatform.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = 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, + url_scheme: str = "https", + interceptor: Optional[ + ReasoningEngineRuntimeRevisionServiceRestInterceptor + ] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to (default: 'aiplatform.googleapis.com'). + 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]): Deprecated. A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. This argument will be + removed in the next major version of this library. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + interceptor (Optional[ReasoningEngineRuntimeRevisionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + url_scheme=url_scheme, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = ( + interceptor or ReasoningEngineRuntimeRevisionServiceRestInterceptor() + ) + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.CancelOperation": [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:cancel", + }, + ], + "google.longrunning.Operations.DeleteOperation": [ + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ], + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDeploymentJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*}/operations", + }, + ], + "google.longrunning.Operations.WaitOperation": [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:wait", + }, + ], + } + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1beta1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _DeleteReasoningEngineRuntimeRevision( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.DeleteReasoningEngineRuntimeRevision" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete reasoning engine + runtime revision method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_http_options() + ) + + request, metadata = ( + self._interceptor.pre_delete_reasoning_engine_runtime_revision( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.DeleteReasoningEngineRuntimeRevision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteReasoningEngineRuntimeRevision", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._DeleteReasoningEngineRuntimeRevision._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_delete_reasoning_engine_runtime_revision(resp) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + self._interceptor.post_delete_reasoning_engine_runtime_revision_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.delete_reasoning_engine_runtime_revision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteReasoningEngineRuntimeRevision", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetReasoningEngineRuntimeRevision( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.GetReasoningEngineRuntimeRevision" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + r"""Call the get reasoning engine + runtime revision method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + ReasoningEngineRuntimeRevision is a + specific version of the runtime related + part of ReasoningEngine. Contains only + the fields that are revision specific. + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_http_options() + ) + + request, metadata = ( + self._interceptor.pre_get_reasoning_engine_runtime_revision( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetReasoningEngineRuntimeRevision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetReasoningEngineRuntimeRevision", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._GetReasoningEngineRuntimeRevision._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + pb_resp = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + resp + ) + ) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_reasoning_engine_runtime_revision(resp) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + self._interceptor.post_get_reasoning_engine_runtime_revision_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.get_reasoning_engine_runtime_revision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetReasoningEngineRuntimeRevision", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _ListReasoningEngineRuntimeRevisions( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.ListReasoningEngineRuntimeRevisions" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ): + r"""Call the list reasoning engine + runtime revisions method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions]. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse: + Response message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions] + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_http_options() + ) + + request, metadata = ( + self._interceptor.pre_list_reasoning_engine_runtime_revisions( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListReasoningEngineRuntimeRevisions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListReasoningEngineRuntimeRevisions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._ListReasoningEngineRuntimeRevisions._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + pb_resp = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + resp + ) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_list_reasoning_engine_runtime_revisions(resp) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + self._interceptor.post_list_reasoning_engine_runtime_revisions_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.list_reasoning_engine_runtime_revisions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListReasoningEngineRuntimeRevisions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + @property + def delete_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest + ], + operations_pb2.Operation, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteReasoningEngineRuntimeRevision(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest + ], + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetReasoningEngineRuntimeRevision(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_reasoning_engine_runtime_revisions( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest + ], + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListReasoningEngineRuntimeRevisions(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_location(self): + return self._GetLocation(self._session, self._host, self._interceptor) # type: ignore + + class _GetLocation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.GetLocation" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: locations_pb2.GetLocationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> locations_pb2.Location: + r"""Call the get location method over HTTP. + + Args: + request (locations_pb2.GetLocationRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + locations_pb2.Location: Response from GetLocation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_http_options() + ) + + request, metadata = self._interceptor.pre_get_location(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._GetLocation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = locations_pb2.Location() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_get_location(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def list_locations(self): + return self._ListLocations(self._session, self._host, self._interceptor) # type: ignore + + class _ListLocations( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.ListLocations" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: locations_pb2.ListLocationsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Call the list locations method over HTTP. + + Args: + request (locations_pb2.ListLocationsRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + locations_pb2.ListLocationsResponse: Response from ListLocations method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_http_options() + ) + + request, metadata = self._interceptor.pre_list_locations(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._ListLocations._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = locations_pb2.ListLocationsResponse() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_list_locations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def get_iam_policy(self): + return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore + + class _GetIamPolicy( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.GetIamPolicy" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__( + self, + request: iam_policy_pb2.GetIamPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Call the get iam policy method over HTTP. + + Args: + request (iam_policy_pb2.GetIamPolicyRequest): + The request object for GetIamPolicy 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + policy_pb2.Policy: Response from GetIamPolicy method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_http_options() + ) + + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._GetIamPolicy._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = policy_pb2.Policy() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_get_iam_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def set_iam_policy(self): + return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore + + class _SetIamPolicy( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.SetIamPolicy" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__( + self, + request: iam_policy_pb2.SetIamPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Call the set iam policy method over HTTP. + + Args: + request (iam_policy_pb2.SetIamPolicyRequest): + The request object for SetIamPolicy 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + policy_pb2.Policy: Response from SetIamPolicy method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_http_options() + ) + + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._SetIamPolicy._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = policy_pb2.Policy() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_set_iam_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def test_iam_permissions(self): + return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore + + class _TestIamPermissions( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.TestIamPermissions" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__( + self, + request: iam_policy_pb2.TestIamPermissionsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Call the test iam permissions method over HTTP. + + Args: + request (iam_policy_pb2.TestIamPermissionsRequest): + The request object for TestIamPermissions 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_http_options() + ) + + request, metadata = self._interceptor.pre_test_iam_permissions( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._TestIamPermissions._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = iam_policy_pb2.TestIamPermissionsResponse() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_test_iam_permissions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def cancel_operation(self): + return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore + + class _CancelOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.CancelOperation" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: operations_pb2.CancelOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Call the cancel operation method over HTTP. + + Args: + request (operations_pb2.CancelOperationRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_http_options() + ) + + request, metadata = self._interceptor.pre_cancel_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._CancelOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + return self._interceptor.post_cancel_operation(None) + + @property + def delete_operation(self): + return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore + + class _DeleteOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.DeleteOperation" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: operations_pb2.DeleteOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Call the delete operation method over HTTP. + + Args: + request (operations_pb2.DeleteOperationRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_http_options() + ) + + request, metadata = self._interceptor.pre_delete_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._DeleteOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + return self._interceptor.post_delete_operation(None) + + @property + def get_operation(self): + return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore + + class _GetOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.GetOperation" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: operations_pb2.GetOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the get operation method over HTTP. + + Args: + request (operations_pb2.GetOperationRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.Operation: Response from GetOperation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_http_options() + ) + + request, metadata = self._interceptor.pre_get_operation(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._GetOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = operations_pb2.Operation() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def list_operations(self): + return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore + + class _ListOperations( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.ListOperations" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: operations_pb2.ListOperationsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Call the list operations method over HTTP. + + Args: + request (operations_pb2.ListOperationsRequest): + The request object 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.ListOperationsResponse: Response from ListOperations method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_http_options() + ) + + request, metadata = self._interceptor.pre_list_operations(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._ListOperations._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = operations_pb2.ListOperationsResponse() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def wait_operation(self): + return self._WaitOperation(self._session, self._host, self._interceptor) # type: ignore + + class _WaitOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation, + ReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "ReasoningEngineRuntimeRevisionServiceRestTransport.WaitOperation" + ) + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__( + self, + request: operations_pb2.WaitOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the wait operation method over HTTP. + + Args: + request (operations_pb2.WaitOperationRequest): + The request object for WaitOperation 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.Operation: Response from WaitOperation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_http_options() + ) + + request, metadata = self._interceptor.pre_wait_operation(request, metadata) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ReasoningEngineRuntimeRevisionServiceRestTransport._WaitOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + content = response.content.decode("utf-8") + resp = operations_pb2.Operation() + resp = json_format.Parse(content, resp) + resp = self._interceptor.post_wait_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("ReasoningEngineRuntimeRevisionServiceRestTransport",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_asyncio.py new file mode 100644 index 0000000000..79440bb452 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_asyncio.py @@ -0,0 +1,4949 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 google.auth + +try: + import aiohttp # type: ignore + from google.auth.aio.transport.sessions import AsyncAuthorizedSession # type: ignore + from google.api_core import rest_streaming_async # type: ignore + from google.api_core.operations_v1 import AsyncOperationsRestClient # type: ignore +except ImportError as e: # pragma: NO COVER + raise ImportError( + "`rest_asyncio` transport requires the library to be installed with the `async_rest` extra. Install the library with the `async_rest` extra using `pip install google-cloud-aiplatform[async_rest]`" + ) from e + +from google.auth.aio import credentials as ga_credentials_async # type: ignore + +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import operations_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.cloud.location import locations_pb2 # type: ignore +from google.api_core import retry_async as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming_async # type: ignore +import google.protobuf + +from google.protobuf import json_format +from google.api_core import operations_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.cloud.location import locations_pb2 # type: ignore + +import json # type: ignore +import dataclasses +from typing import Any, Dict, List, Callable, Tuple, Optional, Sequence, Union + + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +from google.longrunning import operations_pb2 # type: ignore + + +from .rest_base import _BaseReasoningEngineRuntimeRevisionServiceRestTransport + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + + +import logging + +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) + +try: + OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=f"google-auth@{google.auth.__version__}", +) + +if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER + DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ + + +class AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor: + """Asynchronous Interceptor for ReasoningEngineRuntimeRevisionService. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the AsyncReasoningEngineRuntimeRevisionServiceRestTransport. + + .. code-block:: python + class MyCustomReasoningEngineRuntimeRevisionServiceInterceptor(ReasoningEngineRuntimeRevisionServiceRestInterceptor): + async def pre_delete_reasoning_engine_runtime_revision(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + async def post_delete_reasoning_engine_runtime_revision(self, response): + logging.log(f"Received response: {response}") + return response + + async def pre_get_reasoning_engine_runtime_revision(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + async def post_get_reasoning_engine_runtime_revision(self, response): + logging.log(f"Received response: {response}") + return response + + async def pre_list_reasoning_engine_runtime_revisions(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + async def post_list_reasoning_engine_runtime_revisions(self, response): + logging.log(f"Received response: {response}") + return response + + transport = AsyncReasoningEngineRuntimeRevisionServiceRestTransport(interceptor=MyCustomReasoningEngineRuntimeRevisionServiceInterceptor()) + client = async ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + + + """ + + async def pre_delete_reasoning_engine_runtime_revision( + self, + request: reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for delete_reasoning_engine_runtime_revision + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_delete_reasoning_engine_runtime_revision( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_reasoning_engine_runtime_revision + + DEPRECATED. Please use the `post_delete_reasoning_engine_runtime_revision_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_delete_reasoning_engine_runtime_revision` interceptor runs + before the `post_delete_reasoning_engine_runtime_revision_with_metadata` interceptor. + """ + return response + + async def post_delete_reasoning_engine_runtime_revision_with_metadata( + self, + response: operations_pb2.Operation, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]: + """Post-rpc interceptor for delete_reasoning_engine_runtime_revision + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_delete_reasoning_engine_runtime_revision_with_metadata` + interceptor in new development instead of the `post_delete_reasoning_engine_runtime_revision` interceptor. + When both interceptors are used, this `post_delete_reasoning_engine_runtime_revision_with_metadata` interceptor runs after the + `post_delete_reasoning_engine_runtime_revision` interceptor. The (possibly modified) response returned by + `post_delete_reasoning_engine_runtime_revision` will be passed to + `post_delete_reasoning_engine_runtime_revision_with_metadata`. + """ + return response, metadata + + async def pre_get_reasoning_engine_runtime_revision( + self, + request: reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for get_reasoning_engine_runtime_revision + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_get_reasoning_engine_runtime_revision( + self, response: reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + """Post-rpc interceptor for get_reasoning_engine_runtime_revision + + DEPRECATED. Please use the `post_get_reasoning_engine_runtime_revision_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_get_reasoning_engine_runtime_revision` interceptor runs + before the `post_get_reasoning_engine_runtime_revision_with_metadata` interceptor. + """ + return response + + async def post_get_reasoning_engine_runtime_revision_with_metadata( + self, + response: reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for get_reasoning_engine_runtime_revision + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_get_reasoning_engine_runtime_revision_with_metadata` + interceptor in new development instead of the `post_get_reasoning_engine_runtime_revision` interceptor. + When both interceptors are used, this `post_get_reasoning_engine_runtime_revision_with_metadata` interceptor runs after the + `post_get_reasoning_engine_runtime_revision` interceptor. The (possibly modified) response returned by + `post_get_reasoning_engine_runtime_revision` will be passed to + `post_get_reasoning_engine_runtime_revision_with_metadata`. + """ + return response, metadata + + async def pre_list_reasoning_engine_runtime_revisions( + self, + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for list_reasoning_engine_runtime_revisions + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_list_reasoning_engine_runtime_revisions( + self, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ) -> ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ): + """Post-rpc interceptor for list_reasoning_engine_runtime_revisions + + DEPRECATED. Please use the `post_list_reasoning_engine_runtime_revisions_with_metadata` + interceptor instead. + + Override in a subclass to read or manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. This `post_list_reasoning_engine_runtime_revisions` interceptor runs + before the `post_list_reasoning_engine_runtime_revisions_with_metadata` interceptor. + """ + return response + + async def post_list_reasoning_engine_runtime_revisions_with_metadata( + self, + response: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Post-rpc interceptor for list_reasoning_engine_runtime_revisions + + Override in a subclass to read or manipulate the response or metadata after it + is returned by the ReasoningEngineRuntimeRevisionService server but before it is returned to user code. + + We recommend only using this `post_list_reasoning_engine_runtime_revisions_with_metadata` + interceptor in new development instead of the `post_list_reasoning_engine_runtime_revisions` interceptor. + When both interceptors are used, this `post_list_reasoning_engine_runtime_revisions_with_metadata` interceptor runs after the + `post_list_reasoning_engine_runtime_revisions` interceptor. The (possibly modified) response returned by + `post_list_reasoning_engine_runtime_revisions` will be passed to + `post_list_reasoning_engine_runtime_revisions_with_metadata`. + """ + return response, metadata + + async def pre_get_location( + self, + request: locations_pb2.GetLocationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_location + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_get_location( + self, response: locations_pb2.Location + ) -> locations_pb2.Location: + """Post-rpc interceptor for get_location + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_list_locations( + self, + request: locations_pb2.ListLocationsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for list_locations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_list_locations( + self, response: locations_pb2.ListLocationsResponse + ) -> locations_pb2.ListLocationsResponse: + """Post-rpc interceptor for list_locations + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_get_iam_policy( + self, + request: iam_policy_pb2.GetIamPolicyRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_get_iam_policy( + self, response: policy_pb2.Policy + ) -> policy_pb2.Policy: + """Post-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_set_iam_policy( + self, + request: iam_policy_pb2.SetIamPolicyRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_set_iam_policy( + self, response: policy_pb2.Policy + ) -> policy_pb2.Policy: + """Post-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_test_iam_permissions( + self, + request: iam_policy_pb2.TestIamPermissionsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: + """Pre-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_test_iam_permissions( + self, response: iam_policy_pb2.TestIamPermissionsResponse + ) -> iam_policy_pb2.TestIamPermissionsResponse: + """Post-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_cancel_operation( + self, + request: operations_pb2.CancelOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for cancel_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_cancel_operation(self, response: None) -> None: + """Post-rpc interceptor for cancel_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_delete_operation( + self, + request: operations_pb2.DeleteOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for delete_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_delete_operation(self, response: None) -> None: + """Post-rpc interceptor for delete_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_get_operation( + self, + request: operations_pb2.GetOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for get_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_get_operation( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for get_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_list_operations( + self, + request: operations_pb2.ListOperationsRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for list_operations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_list_operations( + self, response: operations_pb2.ListOperationsResponse + ) -> operations_pb2.ListOperationsResponse: + """Post-rpc interceptor for list_operations + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + async def pre_wait_operation( + self, + request: operations_pb2.WaitOperationRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: + """Pre-rpc interceptor for wait_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ReasoningEngineRuntimeRevisionService server. + """ + return request, metadata + + async def post_wait_operation( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for wait_operation + + Override in a subclass to manipulate the response + after it is returned by the ReasoningEngineRuntimeRevisionService server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class AsyncReasoningEngineRuntimeRevisionServiceRestStub: + _session: AsyncAuthorizedSession + _host: str + _interceptor: AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor + + +class AsyncReasoningEngineRuntimeRevisionServiceRestTransport( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport +): + """Asynchronous REST backend transport for ReasoningEngineRuntimeRevisionService. + + Manages Vertex AI's Reasoning Engine Revisions. + + 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 JSON representations of protocol buffers over HTTP/1.1 + """ + + def __init__( + self, + *, + host: str = "aiplatform.googleapis.com", + credentials: Optional[ga_credentials_async.Credentials] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + url_scheme: str = "https", + interceptor: Optional[ + AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor + ] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to (default: 'aiplatform.googleapis.com'). + credentials (Optional[google.auth.aio.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. + 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 are developing + your own client library. + url_scheme (str): the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + interceptor (Optional[AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + """ + # Run the base constructor + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=False, + url_scheme=url_scheme, + api_audience=None, + ) + self._session = AsyncAuthorizedSession(self._credentials) # type: ignore + self._interceptor = ( + interceptor or AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor() + ) + self._wrap_with_kind = True + self._prep_wrapped_messages(client_info) + self._operations_client: Optional[operations_v1.AsyncOperationsRestClient] = ( + None + ) + + def _prep_wrapped_messages(self, client_info): + """Precompute the wrapped methods, overriding the base class method to use async wrappers.""" + self._wrapped_methods = { + self.get_reasoning_engine_runtime_revision: self._wrap_method( + self.get_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.list_reasoning_engine_runtime_revisions: self._wrap_method( + self.list_reasoning_engine_runtime_revisions, + default_timeout=None, + client_info=client_info, + ), + self.delete_reasoning_engine_runtime_revision: self._wrap_method( + self.delete_reasoning_engine_runtime_revision, + default_timeout=None, + client_info=client_info, + ), + self.get_location: self._wrap_method( + self.get_location, + default_timeout=None, + client_info=client_info, + ), + self.list_locations: self._wrap_method( + self.list_locations, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: self._wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: self._wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: self._wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + self.cancel_operation: self._wrap_method( + self.cancel_operation, + default_timeout=None, + client_info=client_info, + ), + self.delete_operation: self._wrap_method( + self.delete_operation, + default_timeout=None, + client_info=client_info, + ), + self.get_operation: self._wrap_method( + self.get_operation, + default_timeout=None, + client_info=client_info, + ), + self.list_operations: self._wrap_method( + self.list_operations, + default_timeout=None, + client_info=client_info, + ), + self.wait_operation: self._wrap_method( + self.wait_operation, + default_timeout=None, + client_info=client_info, + ), + } + + def _wrap_method(self, func, *args, **kwargs): + if self._wrap_with_kind: # pragma: NO COVER + kwargs["kind"] = self.kind + return gapic_v1.method_async.wrap_method(func, *args, **kwargs) + + class _DeleteReasoningEngineRuntimeRevision( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.DeleteReasoningEngineRuntimeRevision" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete reasoning engine + runtime revision method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_http_options() + ) + + request, metadata = ( + await self._interceptor.pre_delete_reasoning_engine_runtime_revision( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.DeleteReasoningEngineRuntimeRevision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteReasoningEngineRuntimeRevision", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._DeleteReasoningEngineRuntimeRevision._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + # Return the response + resp = operations_pb2.Operation() + pb_resp = resp + content = await response.read() + json_format.Parse(content, pb_resp, ignore_unknown_fields=True) + resp = ( + await self._interceptor.post_delete_reasoning_engine_runtime_revision( + resp + ) + ) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + await self._interceptor.post_delete_reasoning_engine_runtime_revision_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.delete_reasoning_engine_runtime_revision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteReasoningEngineRuntimeRevision", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + + return resp + + class _GetReasoningEngineRuntimeRevision( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.GetReasoningEngineRuntimeRevision" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + r"""Call the get reasoning engine + runtime revision method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision: + ReasoningEngineRuntimeRevision is a + specific version of the runtime related + part of ReasoningEngine. Contains only + the fields that are revision specific. + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_http_options() + ) + + request, metadata = ( + await self._interceptor.pre_get_reasoning_engine_runtime_revision( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetReasoningEngineRuntimeRevision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetReasoningEngineRuntimeRevision", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._GetReasoningEngineRuntimeRevision._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + # Return the response + resp = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + pb_resp = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + resp + ) + ) + content = await response.read() + json_format.Parse(content, pb_resp, ignore_unknown_fields=True) + resp = await self._interceptor.post_get_reasoning_engine_runtime_revision( + resp + ) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + await self._interceptor.post_get_reasoning_engine_runtime_revision_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.get_reasoning_engine_runtime_revision", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetReasoningEngineRuntimeRevision", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + + return resp + + class _ListReasoningEngineRuntimeRevisions( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.ListReasoningEngineRuntimeRevisions" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse + ): + r"""Call the list reasoning engine + runtime revisions method over HTTP. + + Args: + request (~.reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest): + The request object. Request message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions]. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse: + Response message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions] + + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_http_options() + ) + + request, metadata = ( + await self._interceptor.pre_list_reasoning_engine_runtime_revisions( + request, metadata + ) + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListReasoningEngineRuntimeRevisions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListReasoningEngineRuntimeRevisions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._ListReasoningEngineRuntimeRevisions._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + # Return the response + resp = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + pb_resp = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + resp + ) + content = await response.read() + json_format.Parse(content, pb_resp, ignore_unknown_fields=True) + resp = await self._interceptor.post_list_reasoning_engine_runtime_revisions( + resp + ) + response_metadata = [(k, str(v)) for k, v in response.headers.items()] + resp, _ = ( + await self._interceptor.post_list_reasoning_engine_runtime_revisions_with_metadata( + resp, response_metadata + ) + ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.list_reasoning_engine_runtime_revisions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListReasoningEngineRuntimeRevisions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + + return resp + + @property + def operations_client(self) -> AsyncOperationsRestClient: + """Create the async client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.CancelOperation": [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:cancel", + }, + ], + "google.longrunning.Operations.DeleteOperation": [ + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ], + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDeploymentJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*}/operations", + }, + ], + "google.longrunning.Operations.WaitOperation": [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:wait", + }, + ], + } + + rest_transport = operations_v1.AsyncOperationsRestTransport( # type: ignore + host=self._host, + # use the credentials which are saved + credentials=self._credentials, # type: ignore + http_options=http_options, + path_prefix="v1beta1", + ) + + self._operations_client = AsyncOperationsRestClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + @property + def delete_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest + ], + operations_pb2.Operation, + ]: + return self._DeleteReasoningEngineRuntimeRevision(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_reasoning_engine_runtime_revision( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest + ], + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + ]: + return self._GetReasoningEngineRuntimeRevision(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_reasoning_engine_runtime_revisions( + self, + ) -> Callable[ + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest + ], + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse, + ]: + return self._ListReasoningEngineRuntimeRevisions(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_location(self): + return self._GetLocation(self._session, self._host, self._interceptor) # type: ignore + + class _GetLocation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.GetLocation" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: locations_pb2.GetLocationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> locations_pb2.Location: + r"""Call the get location method over HTTP. + + Args: + request (locations_pb2.GetLocationRequest): + The request object for GetLocation method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + locations_pb2.Location: Response from GetLocation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_http_options() + ) + + request, metadata = await self._interceptor.pre_get_location( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetLocation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._GetLocation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = locations_pb2.Location() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_get_location(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def list_locations(self): + return self._ListLocations(self._session, self._host, self._interceptor) # type: ignore + + class _ListLocations( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.ListLocations" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: locations_pb2.ListLocationsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Call the list locations method over HTTP. + + Args: + request (locations_pb2.ListLocationsRequest): + The request object for ListLocations method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + locations_pb2.ListLocationsResponse: Response from ListLocations method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_http_options() + ) + + request, metadata = await self._interceptor.pre_list_locations( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListLocations._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._ListLocations._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = locations_pb2.ListLocationsResponse() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_list_locations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def get_iam_policy(self): + return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore + + class _GetIamPolicy( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.GetIamPolicy" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + async def __call__( + self, + request: iam_policy_pb2.GetIamPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Call the get iam policy method over HTTP. + + Args: + request (iam_policy_pb2.GetIamPolicyRequest): + The request object for GetIamPolicy method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + policy_pb2.Policy: Response from GetIamPolicy method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_http_options() + ) + + request, metadata = await self._interceptor.pre_get_iam_policy( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetIamPolicy._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._GetIamPolicy._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = policy_pb2.Policy() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_get_iam_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def set_iam_policy(self): + return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore + + class _SetIamPolicy( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.SetIamPolicy" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + async def __call__( + self, + request: iam_policy_pb2.SetIamPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> policy_pb2.Policy: + r"""Call the set iam policy method over HTTP. + + Args: + request (iam_policy_pb2.SetIamPolicyRequest): + The request object for SetIamPolicy method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + policy_pb2.Policy: Response from SetIamPolicy method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_http_options() + ) + + request, metadata = await self._interceptor.pre_set_iam_policy( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseSetIamPolicy._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._SetIamPolicy._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = policy_pb2.Policy() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_set_iam_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def test_iam_permissions(self): + return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore + + class _TestIamPermissions( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.TestIamPermissions" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + async def __call__( + self, + request: iam_policy_pb2.TestIamPermissionsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Call the test iam permissions method over HTTP. + + Args: + request (iam_policy_pb2.TestIamPermissionsRequest): + The request object for TestIamPermissions method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_http_options() + ) + + request, metadata = await self._interceptor.pre_test_iam_permissions( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_transcoded_request( + http_options, request + ) + + body = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_request_body_json( + transcoded_request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseTestIamPermissions._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._TestIamPermissions._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = iam_policy_pb2.TestIamPermissionsResponse() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_test_iam_permissions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def cancel_operation(self): + return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore + + class _CancelOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.CancelOperation" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: operations_pb2.CancelOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Call the cancel operation method over HTTP. + + Args: + request (operations_pb2.CancelOperationRequest): + The request object for CancelOperation method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_http_options() + ) + + request, metadata = await self._interceptor.pre_cancel_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseCancelOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._CancelOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + return await self._interceptor.post_cancel_operation(None) + + @property + def delete_operation(self): + return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore + + class _DeleteOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.DeleteOperation" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: operations_pb2.DeleteOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Call the delete operation method over HTTP. + + Args: + request (operations_pb2.DeleteOperationRequest): + The request object for DeleteOperation method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_http_options() + ) + + request, metadata = await self._interceptor.pre_delete_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._DeleteOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + return await self._interceptor.post_delete_operation(None) + + @property + def get_operation(self): + return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore + + class _GetOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.GetOperation" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: operations_pb2.GetOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the get operation method over HTTP. + + Args: + request (operations_pb2.GetOperationRequest): + The request object for GetOperation method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.Operation: Response from GetOperation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_http_options() + ) + + request, metadata = await self._interceptor.pre_get_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._GetOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = operations_pb2.Operation() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def list_operations(self): + return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore + + class _ListOperations( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.ListOperations" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: operations_pb2.ListOperationsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Call the list operations method over HTTP. + + Args: + request (operations_pb2.ListOperationsRequest): + The request object for ListOperations method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.ListOperationsResponse: Response from ListOperations method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_http_options() + ) + + request, metadata = await self._interceptor.pre_list_operations( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListOperations._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._ListOperations._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = operations_pb2.ListOperationsResponse() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def wait_operation(self): + return self._WaitOperation(self._session, self._host, self._interceptor) # type: ignore + + class _WaitOperation( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation, + AsyncReasoningEngineRuntimeRevisionServiceRestStub, + ): + def __hash__(self): + return hash( + "AsyncReasoningEngineRuntimeRevisionServiceRestTransport.WaitOperation" + ) + + @staticmethod + async def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None, + ): + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = await getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + async def __call__( + self, + request: operations_pb2.WaitOperationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> operations_pb2.Operation: + r"""Call the wait operation method over HTTP. + + Args: + request (operations_pb2.WaitOperationRequest): + The request object for WaitOperation method. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + operations_pb2.Operation: Response from WaitOperation method. + """ + + http_options = ( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_http_options() + ) + + request, metadata = await self._interceptor.pre_wait_operation( + request, metadata + ) + transcoded_request = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_transcoded_request( + http_options, request + ) + + # Jsonify the query params + query_params = _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseWaitOperation._get_query_params_json( + transcoded_request + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = await AsyncReasoningEngineRuntimeRevisionServiceRestTransport._WaitOperation._get_response( + self._host, + metadata, + query_params, + self._session, + timeout, + transcoded_request, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + content = await response.read() + payload = json.loads(content.decode("utf-8")) + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore + + content = await response.read() + resp = operations_pb2.Operation() + resp = json_format.Parse(content, resp) + resp = await self._interceptor.post_wait_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) + return resp + + @property + def kind(self) -> str: + return "rest_asyncio" + + async def close(self): + await self._session.close() diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_base.py new file mode 100644 index 0000000000..36c038333b --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_runtime_revision_service/transports/rest_base.py @@ -0,0 +1,2896 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 json # type: ignore +from google.api_core import path_template +from google.api_core import gapic_v1 + +from google.protobuf import json_format +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.cloud.location import locations_pb2 # type: ignore +from .base import ReasoningEngineRuntimeRevisionServiceTransport, DEFAULT_CLIENT_INFO + +import re +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union + + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +from google.longrunning import operations_pb2 # type: ignore + + +class _BaseReasoningEngineRuntimeRevisionServiceRestTransport( + ReasoningEngineRuntimeRevisionServiceTransport +): + """Base REST backend transport for ReasoningEngineRuntimeRevisionService. + + Note: This class is not meant to be used directly. Use its sync and + async sub-classes instead. + + 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 JSON representations of protocol buffers over HTTP/1.1 + """ + + def __init__( + self, + *, + host: str = "aiplatform.googleapis.com", + credentials: Optional[Any] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + Args: + host (Optional[str]): + The hostname to connect to (default: 'aiplatform.googleapis.com'). + credentials (Optional[Any]): 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. + 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + class _BaseDeleteReasoningEngineRuntimeRevision: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + use_integers_for_enums=True, + ) + ) + query_params.update( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseDeleteReasoningEngineRuntimeRevision._get_unset_required_fields( + query_params + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetReasoningEngineRuntimeRevision: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + use_integers_for_enums=True, + ) + ) + query_params.update( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseGetReasoningEngineRuntimeRevision._get_unset_required_fields( + query_params + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseListReasoningEngineRuntimeRevisions: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1beta1/{parent=projects/*/locations/*/reasoningEngines/*}/runtimeRevisions", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + use_integers_for_enums=True, + ) + ) + query_params.update( + _BaseReasoningEngineRuntimeRevisionServiceRestTransport._BaseListReasoningEngineRuntimeRevisions._get_unset_required_fields( + query_params + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetLocation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*}", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseListLocations: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/ui/{name=projects/*}/locations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*}/locations", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseGetIamPolicy: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*}:getIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/models/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/endpoints/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/publishers/*/models/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureGroups/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/models/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/endpoints/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/publishers/*/models/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:getIamPolicy", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureGroups/*}:getIamPolicy", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + body = json.dumps(transcoded_request["body"]) + return body + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseSetIamPolicy: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/models/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/endpoints/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureGroups/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/models/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/endpoints/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:setIamPolicy", + "body": "*", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureGroups/*}:setIamPolicy", + "body": "*", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + body = json.dumps(transcoded_request["body"]) + return body + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseTestIamPermissions: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*}:testIamPermissions", + "body": "*", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/models/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/endpoints/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/v1beta1/{resource=projects/*/locations/*/featureGroups/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featurestores/*/entityTypes/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/models/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/endpoints/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/notebookRuntimeTemplates/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureOnlineStores/*/featureViews/*}:testIamPermissions", + }, + { + "method": "post", + "uri": "/ui/{resource=projects/*/locations/*/featureGroups/*}:testIamPermissions", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + body = json.dumps(transcoded_request["body"]) + return body + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseCancelOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:cancel", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:cancel", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseDeleteOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "delete", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseGetOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDeploymentJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseListOperations: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, + { + "method": "get", + "uri": "/v1beta1/{name=onlineEvaluators/*}/operations", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + class _BaseWaitOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/agents/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/apps/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/savedQueries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/datasets/*/dataItems/*/annotations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/deploymentResourcePools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/edgeDevices/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/endpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/evaluationTasks/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/exampleStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensionControllers/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/extensions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featurestores/*/entityTypes/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/customJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/dataLabelingJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/hyperparameterTuningJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/artifacts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/contexts/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/metadataStores/*/executions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelDeploymentMonitoringJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/modelMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/migratableResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/models/*/evaluations/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimes/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/notebookRuntimeTemplates/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/persistentResources/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragEngineConfig/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/memories/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/trials/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/trainingPipelines/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/pipelineJobs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/specialistPools/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/tensorboards/*/experiments/*/runs/*/timeSeries/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, + { + "method": "post", + "uri": "/v1beta1/{name=onlineEvaluators/*/operations/*}:wait", + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + request_kwargs = json_format.MessageToDict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json.dumps(transcoded_request["query_params"])) + return query_params + + +__all__ = ("_BaseReasoningEngineRuntimeRevisionServiceRestTransport",) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/__init__.py index 9bcdc0e3b8..87876db87b 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py index 3ec9cb9c9e..8d57b1eeb0 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -108,6 +108,12 @@ class ReasoningEngineServiceAsyncClient: parse_reasoning_engine_path = staticmethod( ReasoningEngineServiceClient.parse_reasoning_engine_path ) + reasoning_engine_runtime_revision_path = staticmethod( + ReasoningEngineServiceClient.reasoning_engine_runtime_revision_path + ) + parse_reasoning_engine_runtime_revision_path = staticmethod( + ReasoningEngineServiceClient.parse_reasoning_engine_runtime_revision_path + ) common_billing_account_path = staticmethod( ReasoningEngineServiceClient.common_billing_account_path ) @@ -222,7 +228,7 @@ def transport(self) -> ReasoningEngineServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -375,11 +381,11 @@ async def sample_create_reasoning_engine(): ) # Make the request - operation = client.create_reasoning_engine(request=request) + operation = await client.create_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -765,11 +771,11 @@ async def sample_update_reasoning_engine(): ) # Make the request - operation = client.update_reasoning_engine(request=request) + operation = await client.update_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -905,11 +911,11 @@ async def sample_delete_reasoning_engine(): ) # Make the request - operation = client.delete_reasoning_engine(request=request) + operation = await client.delete_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1011,7 +1017,7 @@ async def sample_delete_reasoning_engine(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1037,8 +1043,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1047,7 +1057,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1055,7 +1065,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1066,7 +1076,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1092,8 +1102,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1102,7 +1116,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1110,7 +1124,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1121,7 +1135,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1151,8 +1165,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1161,7 +1179,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1169,7 +1187,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1177,7 +1195,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1206,8 +1224,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1216,7 +1238,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1224,7 +1246,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1232,7 +1254,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1264,8 +1286,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1274,7 +1300,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1282,7 +1308,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1293,7 +1319,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1385,8 +1411,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1395,7 +1425,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1403,7 +1435,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1414,7 +1446,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1507,8 +1539,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1517,7 +1553,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1525,7 +1563,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1536,7 +1574,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1567,8 +1605,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1579,7 +1621,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1587,7 +1631,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1598,7 +1642,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1624,8 +1668,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1634,7 +1682,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1642,7 +1690,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1653,7 +1701,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1679,8 +1727,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1689,7 +1741,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1697,7 +1749,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py index 9f2c11589d..5f668e7497 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ from .transports.grpc_asyncio import ReasoningEngineServiceGrpcAsyncIOTransport from .transports.rest import ReasoningEngineServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncReasoningEngineServiceRestTransport @@ -139,7 +140,7 @@ class ReasoningEngineServiceClient(metaclass=ReasoningEngineServiceClientMeta): """A service for managing Vertex AI's Reasoning Engines.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -147,7 +148,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -157,6 +158,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -342,6 +347,30 @@ def parse_reasoning_engine_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def reasoning_engine_runtime_revision_path( + project: str, + location: str, + reasoning_engine: str, + runtime_revision: str, + ) -> str: + """Returns a fully-qualified reasoning_engine_runtime_revision string.""" + return "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + runtime_revision=runtime_revision, + ) + + @staticmethod + def parse_reasoning_engine_runtime_revision_path(path: str) -> Dict[str, str]: + """Parses a reasoning_engine_runtime_revision path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/reasoningEngines/(?P.+?)/runtimeRevisions/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def common_billing_account_path( billing_account: str, @@ -532,7 +561,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -631,7 +660,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -731,7 +760,7 @@ def __init__( self._universe_domain = ReasoningEngineServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1531,7 +1560,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1557,8 +1586,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1567,7 +1600,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1576,7 +1609,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1590,7 +1623,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1616,8 +1649,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1626,7 +1663,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1635,7 +1672,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1649,7 +1686,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1679,8 +1716,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1689,7 +1730,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1697,7 +1738,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1705,7 +1746,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1734,8 +1775,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1744,7 +1789,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1752,7 +1797,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1760,7 +1805,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1792,8 +1837,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1802,7 +1851,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1811,7 +1860,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1825,7 +1874,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1917,8 +1966,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1927,7 +1980,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1936,7 +1991,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1950,7 +2005,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2043,8 +2098,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2053,7 +2112,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2062,7 +2123,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2076,7 +2137,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2107,8 +2168,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2117,7 +2182,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2126,7 +2193,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2140,7 +2207,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2166,8 +2233,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2176,7 +2247,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2185,7 +2256,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2199,7 +2270,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2225,8 +2296,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2235,7 +2310,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2244,7 +2319,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py index 03a70fea91..9f3e1308d0 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/README.rst index aec8aac318..0453d542c5 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ReasoningEngineServiceTransport` is the ABC for all transports. -- public child `ReasoningEngineServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ReasoningEngineServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseReasoningEngineServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ReasoningEngineServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ReasoningEngineServiceTransport`` is the ABC for all transports. + +- public child ``ReasoningEngineServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ReasoningEngineServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseReasoningEngineServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ReasoningEngineServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__init__.py index 84150e1136..ccc2f20e2c 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/base.py index d3735a8f5b..ad4c325cae 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py index d01ac5cd68..4342b35506 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -191,6 +191,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py index bc36957bcb..d0ad345ebc 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -242,6 +242,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py index 46cf41c439..493250bcb6 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -690,6 +690,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ReasoningEngineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1091,6 +1097,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1493,6 +1503,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1943,6 +1957,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2389,6 +2407,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2835,6 +2857,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py index 34151786cd..668d14058f 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncReasoningEngineServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1995,6 +1997,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2397,6 +2403,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2847,6 +2857,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3293,6 +3307,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3739,6 +3757,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py index 087adce853..9688c76ffc 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1108,6 +1108,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1529,6 +1533,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1998,6 +2006,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2463,6 +2475,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2928,6 +2944,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/__init__.py index 747eaed13f..7f7657bc28 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py index a397b974f7..66d942c139 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -259,7 +259,7 @@ def transport(self) -> ScheduleServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -532,11 +532,11 @@ async def sample_delete_schedule(): ) # Make the request - operation = client.delete_schedule(request=request) + operation = await client.delete_schedule(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1244,7 +1244,7 @@ async def sample_update_schedule(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1270,8 +1270,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1280,7 +1284,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1288,7 +1292,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1299,7 +1303,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1325,8 +1329,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1335,7 +1343,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1343,7 +1351,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1354,7 +1362,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1384,8 +1392,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1394,7 +1406,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1402,7 +1414,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1410,7 +1422,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1439,8 +1451,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1449,7 +1465,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1457,7 +1473,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1465,7 +1481,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1497,8 +1513,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1507,7 +1527,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1515,7 +1535,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1526,7 +1546,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1618,8 +1638,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1628,7 +1652,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1636,7 +1662,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1647,7 +1673,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1740,8 +1766,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1750,7 +1780,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1758,7 +1790,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1769,7 +1801,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1800,8 +1832,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1812,7 +1848,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1820,7 +1858,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1831,7 +1869,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1857,8 +1895,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1867,7 +1909,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1875,7 +1917,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1886,7 +1928,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1912,8 +1954,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1922,7 +1968,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1930,7 +1976,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py index fedaded7bd..321c3f21d6 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ from .transports.grpc_asyncio import ScheduleServiceGrpcAsyncIOTransport from .transports.rest import ScheduleServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncScheduleServiceRestTransport @@ -142,7 +143,7 @@ class ScheduleServiceClient(metaclass=ScheduleServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -150,7 +151,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -160,6 +161,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -824,7 +829,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -921,7 +926,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -1019,7 +1024,7 @@ def __init__( self._universe_domain = ScheduleServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2010,7 +2015,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2036,8 +2041,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2046,7 +2055,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2055,7 +2064,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2069,7 +2078,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2095,8 +2104,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2105,7 +2118,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2114,7 +2127,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2128,7 +2141,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2158,8 +2171,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2168,7 +2185,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2176,7 +2193,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2184,7 +2201,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2213,8 +2230,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2223,7 +2244,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2231,7 +2252,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2239,7 +2260,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2271,8 +2292,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2281,7 +2306,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2290,7 +2315,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2304,7 +2329,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2396,8 +2421,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2406,7 +2435,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2415,7 +2446,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2429,7 +2460,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2522,8 +2553,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2532,7 +2567,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2541,7 +2578,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2555,7 +2592,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2586,8 +2623,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2596,7 +2637,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2605,7 +2648,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2619,7 +2662,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2645,8 +2688,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2655,7 +2702,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2664,7 +2711,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2678,7 +2725,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2704,8 +2751,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2714,7 +2765,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2723,7 +2774,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py index a1acce3120..cb573691ea 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/README.rst index e1a2b3ed17..9045ed99c9 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`ScheduleServiceTransport` is the ABC for all transports. -- public child `ScheduleServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ScheduleServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseScheduleServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ScheduleServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``ScheduleServiceTransport`` is the ABC for all transports. + +- public child ``ScheduleServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``ScheduleServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseScheduleServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``ScheduleServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__init__.py index 61dc9643eb..7efc68c2ab 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/base.py index 1121848944..93bc37abb4 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py index 8b49438934..481f2bffce 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -195,6 +195,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py index 6e8ec6a8b8..7fc3f5f458 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -246,6 +246,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py index fabe89a820..bbc052654d 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -720,6 +720,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[ScheduleServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1121,6 +1127,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1523,6 +1533,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1973,6 +1987,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2419,6 +2437,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2865,6 +2887,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py index 564d042c94..32d818bb02 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -721,6 +721,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncScheduleServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2278,6 +2280,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2680,6 +2686,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3130,6 +3140,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3576,6 +3590,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4022,6 +4040,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py index 4a9b71eb0e..ef0a624914 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1196,6 +1196,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1617,6 +1621,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2086,6 +2094,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2551,6 +2563,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3016,6 +3032,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/session_service/__init__.py index a00026df42..f622ab4cc3 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/session_service/async_client.py index f181fde574..59aa63bdfb 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ def transport(self) -> SessionServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -356,11 +356,11 @@ async def sample_create_session(): ) # Make the request - operation = client.create_session(request=request) + operation = await client.create_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -877,11 +877,11 @@ async def sample_delete_session(): ) # Make the request - operation = client.delete_session(request=request) + operation = await client.delete_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1235,7 +1235,7 @@ async def sample_append_event(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1261,8 +1261,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1271,7 +1275,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1279,7 +1283,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1290,7 +1294,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1316,8 +1320,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1326,7 +1334,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1334,7 +1342,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1345,7 +1353,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1375,8 +1383,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1385,7 +1397,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1393,7 +1405,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1401,7 +1413,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1430,8 +1442,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1440,7 +1456,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1448,7 +1464,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1456,7 +1472,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1488,8 +1504,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1498,7 +1518,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1506,7 +1526,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1517,7 +1537,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1609,8 +1629,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1619,7 +1643,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1627,7 +1653,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1638,7 +1664,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1731,8 +1757,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1741,7 +1771,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1749,7 +1781,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1760,7 +1792,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1791,8 +1823,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1803,7 +1839,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1811,7 +1849,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1822,7 +1860,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1848,8 +1886,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1858,7 +1900,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1866,7 +1908,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1877,7 +1919,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1903,8 +1945,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1913,7 +1959,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1921,7 +1967,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/client.py b/google/cloud/aiplatform_v1beta1/services/session_service/client.py index 0f6c7d54c6..30b2873300 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ from .transports.grpc_asyncio import SessionServiceGrpcAsyncIOTransport from .transports.rest import SessionServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncSessionServiceRestTransport @@ -138,7 +139,7 @@ class SessionServiceClient(metaclass=SessionServiceClientMeta): """The service that manages Vertex Session related resources.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -146,7 +147,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -156,6 +157,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -513,7 +518,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -610,7 +615,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -706,7 +711,7 @@ def __init__( self._universe_domain = SessionServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1742,7 +1747,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1768,8 +1773,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1778,7 +1787,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1787,7 +1796,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1801,7 +1810,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1827,8 +1836,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1837,7 +1850,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1846,7 +1859,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1860,7 +1873,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1890,8 +1903,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1900,7 +1917,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1908,7 +1925,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1916,7 +1933,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1945,8 +1962,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1955,7 +1976,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1963,7 +1984,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1971,7 +1992,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2003,8 +2024,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2013,7 +2038,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2022,7 +2047,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2036,7 +2061,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2128,8 +2153,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2138,7 +2167,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2147,7 +2178,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2161,7 +2192,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2254,8 +2285,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2264,7 +2299,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2273,7 +2310,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2287,7 +2324,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2318,8 +2355,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2328,7 +2369,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2337,7 +2380,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2351,7 +2394,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2377,8 +2420,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2387,7 +2434,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2396,7 +2443,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2410,7 +2457,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2436,8 +2483,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2446,7 +2497,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2455,7 +2506,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/session_service/pagers.py index c02cc28433..75debeb427 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/session_service/transports/README.rst index f67320e75a..ec396d9ed4 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`SessionServiceTransport` is the ABC for all transports. -- public child `SessionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `SessionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseSessionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `SessionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``SessionServiceTransport`` is the ABC for all transports. + +- public child ``SessionServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``SessionServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseSessionServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``SessionServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/__init__.py index d4890abd08..81741f8175 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/base.py index 72b62f08c7..2cbdad3884 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc.py index 7f01abf839..7e8ad2adf7 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc_asyncio.py index 2f48da8962..97227ae263 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest.py index b411864017..179ab95535 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -795,6 +795,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[SessionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1196,6 +1202,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1598,6 +1608,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2048,6 +2062,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2494,6 +2512,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2940,6 +2962,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_asyncio.py index 08e596f8af..0a0a95634c 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -798,6 +798,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncSessionServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2422,6 +2424,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2824,6 +2830,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3274,6 +3284,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3720,6 +3734,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4166,6 +4184,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_base.py index d1dc7cfd32..a3342a1936 100644 --- a/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/session_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1214,6 +1214,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1635,6 +1639,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2104,6 +2112,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2569,6 +2581,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3034,6 +3050,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/__init__.py index 059c08c3db..f861b1e1f1 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py index b9c050d0b8..0acdedec3e 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -208,7 +208,7 @@ def transport(self) -> SpecialistPoolServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -362,11 +362,11 @@ async def sample_create_specialist_pool(): ) # Make the request - operation = client.create_specialist_pool(request=request) + operation = await client.create_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -759,11 +759,11 @@ async def sample_delete_specialist_pool(): ) # Make the request - operation = client.delete_specialist_pool(request=request) + operation = await client.delete_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -900,11 +900,11 @@ async def sample_update_specialist_pool(): ) # Make the request - operation = client.update_specialist_pool(request=request) + operation = await client.update_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1012,7 +1012,7 @@ async def sample_update_specialist_pool(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1038,8 +1038,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1048,7 +1052,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1056,7 +1060,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1067,7 +1071,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1093,8 +1097,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1103,7 +1111,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1111,7 +1119,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1122,7 +1130,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1152,8 +1160,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1162,7 +1174,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1170,7 +1182,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1178,7 +1190,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1207,8 +1219,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1217,7 +1233,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1225,7 +1241,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1233,7 +1249,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1265,8 +1281,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1275,7 +1295,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1283,7 +1303,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1294,7 +1314,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1386,8 +1406,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1396,7 +1420,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1404,7 +1430,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1415,7 +1441,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1508,8 +1534,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1518,7 +1548,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1526,7 +1558,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1537,7 +1569,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1568,8 +1600,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1580,7 +1616,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1588,7 +1626,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1599,7 +1637,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1625,8 +1663,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1635,7 +1677,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1643,7 +1685,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1696,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1680,8 +1722,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1690,7 +1736,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1698,7 +1744,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py index 6fe1aff616..7c5309d9c6 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ from .transports.grpc_asyncio import SpecialistPoolServiceGrpcAsyncIOTransport from .transports.rest import SpecialistPoolServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncSpecialistPoolServiceRestTransport @@ -141,7 +142,7 @@ class SpecialistPoolServiceClient(metaclass=SpecialistPoolServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -149,7 +150,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -159,6 +160,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -466,7 +471,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -565,7 +570,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -665,7 +670,7 @@ def __init__( self._universe_domain = SpecialistPoolServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1480,7 +1485,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1506,8 +1511,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1516,7 +1525,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1525,7 +1534,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1539,7 +1548,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1565,8 +1574,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1575,7 +1588,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1584,7 +1597,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1598,7 +1611,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1628,8 +1641,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1638,7 +1655,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1646,7 +1663,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1654,7 +1671,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1683,8 +1700,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1693,7 +1714,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1701,7 +1722,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1709,7 +1730,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1741,8 +1762,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1751,7 +1776,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1760,7 +1785,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1774,7 +1799,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1866,8 +1891,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1876,7 +1905,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1885,7 +1916,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1899,7 +1930,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1992,8 +2023,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2002,7 +2037,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2011,7 +2048,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2025,7 +2062,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2056,8 +2093,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2066,7 +2107,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2075,7 +2118,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2089,7 +2132,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2115,8 +2158,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2125,7 +2172,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2134,7 +2181,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2148,7 +2195,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2174,8 +2221,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2184,7 +2235,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2193,7 +2244,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py index 6983f8239d..4efdf89b0e 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/README.rst index 5e31a11c15..9d985be883 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`SpecialistPoolServiceTransport` is the ABC for all transports. -- public child `SpecialistPoolServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `SpecialistPoolServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseSpecialistPoolServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `SpecialistPoolServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``SpecialistPoolServiceTransport`` is the ABC for all transports. + +- public child ``SpecialistPoolServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``SpecialistPoolServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseSpecialistPoolServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``SpecialistPoolServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__init__.py index 5aadf157f9..052851c414 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/base.py index d867e76939..932fb2ec51 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -136,6 +140,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py index d0bb1e7891..1b288c91f5 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -96,7 +96,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -196,6 +196,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py index db9dfe110c..4dd1fcbf05 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -102,7 +102,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -247,6 +247,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py index 78119861e7..e1c1e93e2f 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[SpecialistPoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1094,6 +1100,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1496,6 +1506,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1946,6 +1960,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2392,6 +2410,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2838,6 +2860,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py index 3b4a8f0b40..8946fdb94d 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -694,6 +694,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncSpecialistPoolServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -1990,6 +1992,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2392,6 +2398,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2842,6 +2852,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3288,6 +3302,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3734,6 +3752,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py index 1356064d85..4c955e5a5c 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1080,6 +1080,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1501,6 +1505,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1970,6 +1978,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2435,6 +2447,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2900,6 +2916,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__init__.py index b7458d641e..cc6fccd0b6 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py index a01b354a89..bf3fd8c2f3 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -229,7 +229,7 @@ def transport(self) -> TensorboardServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -382,11 +382,11 @@ async def sample_create_tensorboard(): ) # Make the request - operation = client.create_tensorboard(request=request) + operation = await client.create_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -640,11 +640,11 @@ async def sample_update_tensorboard(): ) # Make the request - operation = client.update_tensorboard(request=request) + operation = await client.update_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -915,11 +915,11 @@ async def sample_delete_tensorboard(): ) # Make the request - operation = client.delete_tensorboard(request=request) + operation = await client.delete_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1810,11 +1810,11 @@ async def sample_delete_tensorboard_experiment(): ) # Make the request - operation = client.delete_tensorboard_experiment(request=request) + operation = await client.delete_tensorboard_experiment(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2613,11 +2613,11 @@ async def sample_delete_tensorboard_run(): ) # Make the request - operation = client.delete_tensorboard_run(request=request) + operation = await client.delete_tensorboard_run(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3415,11 +3415,11 @@ async def sample_delete_tensorboard_time_series(): ) # Make the request - operation = client.delete_tensorboard_time_series(request=request) + operation = await client.delete_tensorboard_time_series(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -4308,7 +4308,7 @@ async def sample_export_tensorboard_time_series_data(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4334,8 +4334,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4344,7 +4348,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4352,7 +4356,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4363,7 +4367,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4389,8 +4393,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4399,7 +4407,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4407,7 +4415,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4418,7 +4426,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4448,8 +4456,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4458,7 +4470,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4466,7 +4478,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4474,7 +4486,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4503,8 +4515,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4513,7 +4529,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4521,7 +4537,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4529,7 +4545,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4561,8 +4577,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4571,7 +4591,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4579,7 +4599,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4590,7 +4610,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4682,8 +4702,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4692,7 +4716,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4700,7 +4726,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4711,7 +4737,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4804,8 +4830,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4814,7 +4844,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4822,7 +4854,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4833,7 +4865,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4864,8 +4896,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4876,7 +4912,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4884,7 +4922,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4895,7 +4933,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4921,8 +4959,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4931,7 +4973,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4939,7 +4981,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4950,7 +4992,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4976,8 +5018,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4986,7 +5032,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4994,7 +5040,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py index 37290dd92b..f28e07a422 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -93,6 +93,7 @@ from .transports.grpc_asyncio import TensorboardServiceGrpcAsyncIOTransport from .transports.rest import TensorboardServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncTensorboardServiceRestTransport @@ -149,7 +150,7 @@ class TensorboardServiceClient(metaclass=TensorboardServiceClientMeta): """TensorboardService""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -157,7 +158,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -167,6 +168,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -554,7 +559,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -651,7 +656,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -751,7 +756,7 @@ def __init__( self._universe_domain = TensorboardServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -4802,7 +4807,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4828,8 +4833,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4838,7 +4847,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4847,7 +4856,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4861,7 +4870,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4887,8 +4896,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4897,7 +4910,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4906,7 +4919,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4920,7 +4933,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4950,8 +4963,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4960,7 +4977,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4968,7 +4985,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4976,7 +4993,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5005,8 +5022,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5015,7 +5036,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5023,7 +5044,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5031,7 +5052,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5063,8 +5084,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5073,7 +5098,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5082,7 +5107,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5096,7 +5121,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5188,8 +5213,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5198,7 +5227,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5207,7 +5238,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5221,7 +5252,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5314,8 +5345,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5324,7 +5359,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5333,7 +5370,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5347,7 +5384,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5378,8 +5415,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5388,7 +5429,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -5397,7 +5440,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5411,7 +5454,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5437,8 +5480,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5447,7 +5494,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5456,7 +5503,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -5470,7 +5517,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -5496,8 +5543,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -5506,7 +5557,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -5515,7 +5566,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py index c939eb36e5..9e7ebac0f2 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/README.rst index c72df371f0..70822fce1f 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`TensorboardServiceTransport` is the ABC for all transports. -- public child `TensorboardServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `TensorboardServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseTensorboardServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `TensorboardServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``TensorboardServiceTransport`` is the ABC for all transports. + +- public child ``TensorboardServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``TensorboardServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseTensorboardServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``TensorboardServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__init__.py index fe4d73f7f5..a4f4888bf0 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/base.py index b6f1c863df..069f06bb75 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -97,6 +97,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -146,6 +150,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py index 2accaca81f..5107bb2ab3 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -106,7 +106,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -201,6 +201,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py index 39e69281a0..faa3504147 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -112,7 +112,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -252,6 +252,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py index 14df86aa43..b8b9b0aa94 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2183,6 +2183,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[TensorboardServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2584,6 +2590,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2986,6 +2996,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3436,6 +3450,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3882,6 +3900,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4328,6 +4350,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py index 235ec627fa..8e3888e39d 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2185,6 +2185,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncTensorboardServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -7784,6 +7786,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -8186,6 +8192,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -8636,6 +8646,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -9082,6 +9096,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -9528,6 +9546,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py index cdbf4ff196..f29ca76f31 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2417,6 +2417,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2838,6 +2842,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3307,6 +3315,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3772,6 +3784,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -4237,6 +4253,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__init__.py index cca9bafda3..ec0458d040 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py index 6abe28afd1..49c86ad5a4 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -224,7 +224,7 @@ def transport(self) -> VertexRagDataServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -377,11 +377,11 @@ async def sample_create_rag_corpus(): ) # Make the request - operation = client.create_rag_corpus(request=request) + operation = await client.create_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -515,11 +515,11 @@ async def sample_update_rag_corpus(): ) # Make the request - operation = client.update_rag_corpus(request=request) + operation = await client.update_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -887,11 +887,11 @@ async def sample_delete_rag_corpus(): ) # Make the request - operation = client.delete_rag_corpus(request=request) + operation = await client.delete_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1169,11 +1169,11 @@ async def sample_import_rag_files(): ) # Make the request - operation = client.import_rag_files(request=request) + operation = await client.import_rag_files(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1549,11 +1549,11 @@ async def sample_delete_rag_file(): ) # Make the request - operation = client.delete_rag_file(request=request) + operation = await client.delete_rag_file(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1684,11 +1684,11 @@ async def sample_update_rag_engine_config(): ) # Make the request - operation = client.update_rag_engine_config(request=request) + operation = await client.update_rag_engine_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2080,11 +2080,11 @@ async def sample_batch_create_rag_data_schemas(): ) # Make the request - operation = client.batch_create_rag_data_schemas(request=request) + operation = await client.batch_create_rag_data_schemas(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2530,11 +2530,11 @@ async def sample_batch_delete_rag_data_schemas(): ) # Make the request - operation = client.batch_delete_rag_data_schemas(request=request) + operation = await client.batch_delete_rag_data_schemas(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -2784,11 +2784,11 @@ async def sample_batch_create_rag_metadata(): ) # Make the request - operation = client.batch_create_rag_metadata(request=request) + operation = await client.batch_create_rag_metadata(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3347,11 +3347,11 @@ async def sample_batch_delete_rag_metadata(): ) # Make the request - operation = client.batch_delete_rag_metadata(request=request) + operation = await client.batch_delete_rag_metadata(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -3428,7 +3428,7 @@ async def sample_batch_delete_rag_metadata(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3454,8 +3454,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3464,7 +3468,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3472,7 +3476,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3483,7 +3487,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3509,8 +3513,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3519,7 +3527,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3527,7 +3535,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3538,7 +3546,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3568,8 +3576,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3578,7 +3590,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3586,7 +3598,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3594,7 +3606,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3623,8 +3635,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3633,7 +3649,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3641,7 +3657,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3649,7 +3665,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3681,8 +3697,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3691,7 +3711,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3699,7 +3719,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3710,7 +3730,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3802,8 +3822,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3812,7 +3836,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3820,7 +3846,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3831,7 +3857,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3924,8 +3950,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3934,7 +3964,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3942,7 +3974,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3953,7 +3985,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3984,8 +4016,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3996,7 +4032,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4004,7 +4042,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4015,7 +4053,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4041,8 +4079,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4051,7 +4093,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4059,7 +4101,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4070,7 +4112,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4096,8 +4138,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4106,7 +4152,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4114,7 +4160,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py index d826725462..f9e8011879 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,6 +81,7 @@ from .transports.grpc_asyncio import VertexRagDataServiceGrpcAsyncIOTransport from .transports.rest import VertexRagDataServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVertexRagDataServiceRestTransport @@ -137,7 +138,7 @@ class VertexRagDataServiceClient(metaclass=VertexRagDataServiceClientMeta): """A service for managing user data for RAG.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -145,7 +146,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -155,6 +156,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -622,7 +627,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -719,7 +724,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -819,7 +824,7 @@ def __init__( self._universe_domain = VertexRagDataServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -3986,7 +3991,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4012,8 +4017,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4022,7 +4031,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4031,7 +4040,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4045,7 +4054,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4071,8 +4080,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4081,7 +4094,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4090,7 +4103,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4104,7 +4117,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4134,8 +4147,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4144,7 +4161,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4152,7 +4169,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4160,7 +4177,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4189,8 +4206,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4199,7 +4220,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4207,7 +4228,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4215,7 +4236,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4247,8 +4268,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4257,7 +4282,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4266,7 +4291,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4280,7 +4305,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4372,8 +4397,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4382,7 +4411,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4391,7 +4422,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4405,7 +4436,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4498,8 +4529,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4508,7 +4543,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4517,7 +4554,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4531,7 +4568,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4562,8 +4599,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4572,7 +4613,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -4581,7 +4624,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4595,7 +4638,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4621,8 +4664,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4631,7 +4678,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4640,7 +4687,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -4654,7 +4701,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -4680,8 +4727,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -4690,7 +4741,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -4699,7 +4750,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py index 821f8d15f5..9855a344e4 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/README.rst index b32f03f312..3509f5a817 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VertexRagDataServiceTransport` is the ABC for all transports. -- public child `VertexRagDataServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VertexRagDataServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVertexRagDataServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VertexRagDataServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VertexRagDataServiceTransport`` is the ABC for all transports. + +- public child ``VertexRagDataServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VertexRagDataServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVertexRagDataServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VertexRagDataServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__init__.py index b0f0007ee7..241a9623a2 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/base.py index d5f0d34c84..f3e26d7c0b 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,6 +88,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -137,6 +141,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py index a5d89e1bba..1cc5821efe 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -97,7 +97,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -192,6 +192,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py index fc08fd9103..f23b270806 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -103,7 +103,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -243,6 +243,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py index 99e66b9a8c..775510392c 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1767,6 +1767,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VertexRagDataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -2168,6 +2174,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2570,6 +2580,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3020,6 +3034,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3466,6 +3484,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3912,6 +3934,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py index 2cd1a7359c..8aafee2600 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1768,6 +1768,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVertexRagDataServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -6312,6 +6314,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -6714,6 +6720,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -7164,6 +7174,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -7610,6 +7624,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -8056,6 +8074,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py index b8967f39c2..2355689296 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2129,6 +2129,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2550,6 +2554,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3019,6 +3027,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3484,6 +3496,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3949,6 +3965,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/__init__.py index 4daee04571..ea16b8c279 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py index 60603c8d06..85e4f322bf 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -193,7 +193,7 @@ def transport(self) -> VertexRagServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -869,11 +869,11 @@ async def sample_async_retrieve_contexts(): ) # Make the request - operation = client.async_retrieve_contexts(request=request) + operation = await client.async_retrieve_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -973,7 +973,7 @@ async def sample_async_retrieve_contexts(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -999,8 +999,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1009,7 +1013,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1017,7 +1021,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1028,7 +1032,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1054,8 +1058,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1064,7 +1072,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1072,7 +1080,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1083,7 +1091,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1113,8 +1121,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1123,7 +1135,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1131,7 +1143,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1139,7 +1151,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1168,8 +1180,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1178,7 +1194,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1186,7 +1202,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1194,7 +1210,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1226,8 +1242,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1236,7 +1256,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1244,7 +1264,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1255,7 +1275,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1347,8 +1367,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1357,7 +1381,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1365,7 +1391,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1376,7 +1402,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1469,8 +1495,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1479,7 +1509,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1487,7 +1519,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1498,7 +1530,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1529,8 +1561,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1541,7 +1577,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1549,7 +1587,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1560,7 +1598,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1586,8 +1624,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1596,7 +1638,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1604,7 +1646,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1615,7 +1657,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1641,8 +1683,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1651,7 +1697,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1659,7 +1705,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py index 9b94c6b5b6..ffc962619d 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ from .transports.grpc_asyncio import VertexRagServiceGrpcAsyncIOTransport from .transports.rest import VertexRagServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVertexRagServiceRestTransport @@ -132,7 +133,7 @@ class VertexRagServiceClient(metaclass=VertexRagServiceClientMeta): """A service for retrieving relevant contexts.""" @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -140,7 +141,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -150,6 +151,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -457,7 +462,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -554,7 +559,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -652,7 +657,7 @@ def __init__( self._universe_domain = VertexRagServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -1445,7 +1450,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1471,8 +1476,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1481,7 +1490,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1490,7 +1499,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1504,7 +1513,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1530,8 +1539,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1540,7 +1553,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1549,7 +1562,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1563,7 +1576,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1593,8 +1606,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1603,7 +1620,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1611,7 +1628,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1619,7 +1636,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1648,8 +1665,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1658,7 +1679,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1666,7 +1687,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1674,7 +1695,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1706,8 +1727,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1716,7 +1741,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -1725,7 +1750,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1739,7 +1764,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1831,8 +1856,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1841,7 +1870,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1850,7 +1881,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1864,7 +1895,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1957,8 +1988,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1967,7 +2002,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -1976,7 +2013,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -1990,7 +2027,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2021,8 +2058,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2031,7 +2072,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2040,7 +2083,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2054,7 +2097,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2080,8 +2123,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2090,7 +2137,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2099,7 +2146,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2113,7 +2160,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2139,8 +2186,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2149,7 +2200,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2158,7 +2209,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/README.rst index fd123be16c..fc1d9c6918 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VertexRagServiceTransport` is the ABC for all transports. -- public child `VertexRagServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VertexRagServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVertexRagServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VertexRagServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VertexRagServiceTransport`` is the ABC for all transports. + +- public child ``VertexRagServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VertexRagServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVertexRagServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VertexRagServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__init__.py index 11c659e82f..380be92ca6 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/base.py index 577aa8f7a5..8aae7a47fb 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -135,6 +139,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py index 39f4dfc46d..874949bacf 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -95,7 +95,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -190,6 +190,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py index 617298f4c1..86351c1fd7 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -101,7 +101,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -241,6 +241,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py index 0a1b3dded6..c366f42451 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -693,6 +693,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VertexRagServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1094,6 +1100,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1496,6 +1506,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1946,6 +1960,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2392,6 +2410,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2838,6 +2860,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py index 25bff4bf40..dea3699db2 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -694,6 +694,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVertexRagServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -2003,6 +2005,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2405,6 +2411,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2855,6 +2865,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -3301,6 +3315,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3747,6 +3765,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py index 96d72c4ad2..74fcc2131d 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1107,6 +1107,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1528,6 +1532,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -1997,6 +2005,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2462,6 +2474,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -2927,6 +2943,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/__init__.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/__init__.py index 85fe3cba26..fe359b0e97 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py index b9ad12b0f0..c0632b843b 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -203,7 +203,7 @@ def transport(self) -> VizierServiceTransport: return self._client.transport @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -929,11 +929,11 @@ async def sample_suggest_trials(): ) # Make the request - operation = client.suggest_trials(request=request) + operation = await client.suggest_trials(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1681,11 +1681,11 @@ async def sample_check_trial_early_stopping_state(): ) # Make the request - operation = client.check_trial_early_stopping_state(request=request) + operation = await client.check_trial_early_stopping_state(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) @@ -1957,7 +1957,7 @@ async def sample_list_optimal_trials(): async def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -1983,8 +1983,12 @@ async def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1993,7 +1997,7 @@ async def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2001,7 +2005,7 @@ async def list_operations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2012,7 +2016,7 @@ async def list_operations( async def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2038,8 +2042,12 @@ async def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2048,7 +2056,7 @@ async def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2056,7 +2064,7 @@ async def get_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2067,7 +2075,7 @@ async def get_operation( async def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2097,8 +2105,12 @@ async def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2107,7 +2119,7 @@ async def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2115,7 +2127,7 @@ async def delete_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2123,7 +2135,7 @@ async def delete_operation( async def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2152,8 +2164,12 @@ async def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2162,7 +2178,7 @@ async def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2170,7 +2186,7 @@ async def cancel_operation( # Send the request. await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2178,7 +2194,7 @@ async def cancel_operation( async def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2210,8 +2226,12 @@ async def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2220,7 +2240,7 @@ async def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2228,7 +2248,7 @@ async def wait_operation( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2239,7 +2259,7 @@ async def wait_operation( async def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2331,8 +2351,12 @@ async def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2341,7 +2365,9 @@ async def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2349,7 +2375,7 @@ async def set_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2360,7 +2386,7 @@ async def set_iam_policy( async def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2453,8 +2479,12 @@ async def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2463,7 +2493,9 @@ async def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2471,7 +2503,7 @@ async def get_iam_policy( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2482,7 +2514,7 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2513,8 +2545,12 @@ async def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2525,7 +2561,9 @@ async def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2533,7 +2571,7 @@ async def test_iam_permissions( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2544,7 +2582,7 @@ async def test_iam_permissions( async def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2570,8 +2608,12 @@ async def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2580,7 +2622,7 @@ async def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2588,7 +2630,7 @@ async def get_location( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2599,7 +2641,7 @@ async def get_location( async def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2625,8 +2667,12 @@ async def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2635,7 +2681,7 @@ async def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2643,7 +2689,7 @@ async def list_locations( # Send the request. response = await rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py index bf5909c734..3b9927ef57 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ from .transports.grpc_asyncio import VizierServiceGrpcAsyncIOTransport from .transports.rest import VizierServiceRestTransport +ASYNC_REST_EXCEPTION = None try: from .transports.rest_asyncio import AsyncVizierServiceRestTransport @@ -136,7 +137,7 @@ class VizierServiceClient(metaclass=VizierServiceClientMeta): """ @staticmethod - def _get_default_mtls_endpoint(api_endpoint): + def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]: """Converts api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to @@ -144,7 +145,7 @@ def _get_default_mtls_endpoint(api_endpoint): Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: - str: converted mTLS api endpoint. + Optional[str]: converted mTLS api endpoint. """ if not api_endpoint: return api_endpoint @@ -154,6 +155,10 @@ def _get_default_mtls_endpoint(api_endpoint): ) m = mtls_endpoint_re.match(api_endpoint) + if m is None: + # Could not parse api_endpoint; return as-is. + return api_endpoint + name, mtls, sandbox, googledomain = m.groups() if mtls or not googledomain: return api_endpoint @@ -507,7 +512,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint - ): + ) -> str: """Return the API endpoint used by the client. Args: @@ -604,7 +609,7 @@ def _add_cred_info_for_auth_errors( error._details.append(json.dumps(cred_info)) @property - def api_endpoint(self): + def api_endpoint(self) -> str: """Return the API endpoint used by the client instance. Returns: @@ -700,7 +705,7 @@ def __init__( self._universe_domain = VizierServiceClient._get_universe_domain( universe_domain_opt, self._universe_domain_env ) - self._api_endpoint = None # updated below, depending on `transport` + self._api_endpoint: str = "" # updated below, depending on `transport` # Initialize the universe domain validation. self._is_universe_domain_valid = False @@ -2445,7 +2450,7 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: Optional[operations_pb2.ListOperationsRequest] = None, + request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2471,8 +2476,12 @@ def list_operations( # 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) + if request is None: + request_pb = operations_pb2.ListOperationsRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.ListOperationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2481,7 +2490,7 @@ def list_operations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2490,7 +2499,7 @@ def list_operations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2504,7 +2513,7 @@ def list_operations( def get_operation( self, - request: Optional[operations_pb2.GetOperationRequest] = None, + request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2530,8 +2539,12 @@ def get_operation( # 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) + if request is None: + request_pb = operations_pb2.GetOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.GetOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2540,7 +2553,7 @@ def get_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2549,7 +2562,7 @@ def get_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2563,7 +2576,7 @@ def get_operation( def delete_operation( self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, + request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2593,8 +2606,12 @@ def delete_operation( # 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) + if request is None: + request_pb = operations_pb2.DeleteOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.DeleteOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2603,7 +2620,7 @@ def delete_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2611,7 +2628,7 @@ def delete_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2619,7 +2636,7 @@ def delete_operation( def cancel_operation( self, - request: Optional[operations_pb2.CancelOperationRequest] = None, + request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2648,8 +2665,12 @@ def cancel_operation( # 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) + if request is None: + request_pb = operations_pb2.CancelOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.CancelOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2658,7 +2679,7 @@ def cancel_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2666,7 +2687,7 @@ def cancel_operation( # Send the request. rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2674,7 +2695,7 @@ def cancel_operation( def wait_operation( self, - request: Optional[operations_pb2.WaitOperationRequest] = None, + request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2706,8 +2727,12 @@ def wait_operation( # 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.WaitOperationRequest(**request) + if request is None: + request_pb = operations_pb2.WaitOperationRequest() + elif isinstance(request, dict): + request_pb = operations_pb2.WaitOperationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2716,7 +2741,7 @@ def wait_operation( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -2725,7 +2750,7 @@ def wait_operation( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2739,7 +2764,7 @@ def wait_operation( def set_iam_policy( self, - request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2831,8 +2856,12 @@ def set_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.SetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.SetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2841,7 +2870,9 @@ def set_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2850,7 +2881,7 @@ def set_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2864,7 +2895,7 @@ def set_iam_policy( def get_iam_policy( self, - request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -2957,8 +2988,12 @@ def get_iam_policy( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) + if request is None: + request_pb = iam_policy_pb2.GetIamPolicyRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.GetIamPolicyRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2967,7 +3002,9 @@ def get_iam_policy( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -2976,7 +3013,7 @@ def get_iam_policy( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -2990,7 +3027,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3021,8 +3058,12 @@ def test_iam_permissions( # The request isn't a proto-plus wrapped type, # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) + if request is None: + request_pb = iam_policy_pb2.TestIamPermissionsRequest() + elif isinstance(request, dict): + request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3031,7 +3072,9 @@ def test_iam_permissions( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request_pb.resource),) + ), ) # Validate the universe domain. @@ -3040,7 +3083,7 @@ def test_iam_permissions( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3054,7 +3097,7 @@ def test_iam_permissions( def get_location( self, - request: Optional[locations_pb2.GetLocationRequest] = None, + request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3080,8 +3123,12 @@ def get_location( # 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) + if request is None: + request_pb = locations_pb2.GetLocationRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.GetLocationRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3090,7 +3137,7 @@ def get_location( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3099,7 +3146,7 @@ def get_location( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, @@ -3113,7 +3160,7 @@ def get_location( def list_locations( self, - request: Optional[locations_pb2.ListLocationsRequest] = None, + request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, @@ -3139,8 +3186,12 @@ def list_locations( # 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) + if request is None: + request_pb = locations_pb2.ListLocationsRequest() + elif isinstance(request, dict): + request_pb = locations_pb2.ListLocationsRequest(**request) + else: + request_pb = request # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -3149,7 +3200,7 @@ def list_locations( # 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),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)), ) # Validate the universe domain. @@ -3158,7 +3209,7 @@ def list_locations( try: # Send the request. response = rpc( - request, + request_pb, retry=retry, timeout=timeout, metadata=metadata, diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py index cebc47a83f..4335047c3c 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/README.rst b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/README.rst index 2761e34629..614e1fd8b3 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/README.rst +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/README.rst @@ -2,8 +2,9 @@ transport inheritance structure _______________________________ -`VizierServiceTransport` is the ABC for all transports. -- public child `VizierServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `VizierServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseVizierServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `VizierServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). +``VizierServiceTransport`` is the ABC for all transports. + +- public child ``VizierServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``). +- public child ``VizierServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``). +- private child ``_BaseVizierServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``). +- public child ``VizierServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``). diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__init__.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__init__.py index 6428db1e28..a7bbdd9840 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__init__.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/base.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/base.py index ac6b65a276..9c222517f0 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/base.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -89,6 +89,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Save the scopes. @@ -138,6 +142,8 @@ def __init__( host += ":443" self._host = host + self._wrapped_methods: Dict[Callable, Callable] = {} + @property def host(self): return self._host diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py index 201f70c2d6..0d125a0cd5 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -98,7 +98,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request): elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -197,6 +197,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py index e3a1692331..4324e2c391 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(request, google.protobuf.message.Message): request_payload = MessageToJson(request) else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}" request_metadata = { key: value.decode("utf-8") if isinstance(value, bytes) else value @@ -104,7 +104,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request elif isinstance(result, google.protobuf.message.Message): response_payload = MessageToJson(result) else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}" grpc_response = { "payload": response_payload, "metadata": metadata, @@ -248,6 +248,10 @@ def __init__( your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py index ac26c79a27..4cd5b51fac 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1145,6 +1145,12 @@ def __init__( url_scheme: the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[VizierServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. + api_audience (Optional[str]): The intended audience for the API calls + to the service that will be set when using certain 3rd party + authentication flows. Audience is typically a resource identifier. + If not set, the host value will be used as a default. """ # Run the base constructor # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. @@ -1546,6 +1552,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -1948,6 +1958,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2398,6 +2412,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2844,6 +2862,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3290,6 +3312,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py index 3ed7a4d36d..9f34f5a8c3 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1146,6 +1146,8 @@ def __init__( url_scheme (str): the protocol scheme for the API endpoint. Normally "https", but for testing or local servers, "http" can be specified. + interceptor (Optional[AsyncVizierServiceRestInterceptor]): Interceptor used + to manipulate requests, request metadata, and responses. """ # Run the base constructor super().__init__( @@ -4055,6 +4057,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -4457,6 +4463,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -4907,6 +4917,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -5353,6 +5367,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -5799,6 +5817,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py index 06843caaea..577af7e2b1 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1620,6 +1620,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:cancel", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:cancel", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/schedules/*/operations/*}:cancel", @@ -2041,6 +2045,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2510,6 +2518,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*/operations/*}", @@ -2975,6 +2987,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}/operations", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/solvers/*}/operations", @@ -3440,6 +3456,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/sessions/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/studies/*/operations/*}:wait", diff --git a/google/cloud/aiplatform_v1beta1/types/__init__.py b/google/cloud/aiplatform_v1beta1/types/__init__.py index 58d1fece91..95a260292c 100644 --- a/google/cloud/aiplatform_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform_v1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1221,10 +1221,22 @@ AsyncQueryReasoningEngineOperationMetadata, AsyncQueryReasoningEngineRequest, AsyncQueryReasoningEngineResponse, + CancelAsyncQueryReasoningEngineRequest, + CancelAsyncQueryReasoningEngineResponse, QueryReasoningEngineRequest, QueryReasoningEngineResponse, StreamQueryReasoningEngineRequest, ) +from .reasoning_engine_runtime_revision import ( + ReasoningEngineRuntimeRevision, +) +from .reasoning_engine_runtime_revision_service import ( + DeleteReasoningEngineRuntimeRevisionOperationMetadata, + DeleteReasoningEngineRuntimeRevisionRequest, + GetReasoningEngineRuntimeRevisionRequest, + ListReasoningEngineRuntimeRevisionsRequest, + ListReasoningEngineRuntimeRevisionsResponse, +) from .reasoning_engine_service import ( CreateReasoningEngineOperationMetadata, CreateReasoningEngineRequest, @@ -2540,9 +2552,17 @@ "AsyncQueryReasoningEngineOperationMetadata", "AsyncQueryReasoningEngineRequest", "AsyncQueryReasoningEngineResponse", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", "QueryReasoningEngineRequest", "QueryReasoningEngineResponse", "StreamQueryReasoningEngineRequest", + "ReasoningEngineRuntimeRevision", + "DeleteReasoningEngineRuntimeRevisionOperationMetadata", + "DeleteReasoningEngineRuntimeRevisionRequest", + "GetReasoningEngineRuntimeRevisionRequest", + "ListReasoningEngineRuntimeRevisionsRequest", + "ListReasoningEngineRuntimeRevisionsResponse", "CreateReasoningEngineOperationMetadata", "CreateReasoningEngineRequest", "DeleteReasoningEngineRequest", diff --git a/google/cloud/aiplatform_v1beta1/types/accelerator_type.py b/google/cloud/aiplatform_v1beta1/types/accelerator_type.py index 62e6dec05d..a5b958e018 100644 --- a/google/cloud/aiplatform_v1beta1/types/accelerator_type.py +++ b/google/cloud/aiplatform_v1beta1/types/accelerator_type.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/annotation.py b/google/cloud/aiplatform_v1beta1/types/annotation.py index b23968480c..6384c59702 100644 --- a/google/cloud/aiplatform_v1beta1/types/annotation.py +++ b/google/cloud/aiplatform_v1beta1/types/annotation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/annotation_spec.py b/google/cloud/aiplatform_v1beta1/types/annotation_spec.py index 0b3a2ab087..3d2871ac76 100644 --- a/google/cloud/aiplatform_v1beta1/types/annotation_spec.py +++ b/google/cloud/aiplatform_v1beta1/types/annotation_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/api_auth.py b/google/cloud/aiplatform_v1beta1/types/api_auth.py index fe6821c01b..e2e3898983 100644 --- a/google/cloud/aiplatform_v1beta1/types/api_auth.py +++ b/google/cloud/aiplatform_v1beta1/types/api_auth.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/artifact.py b/google/cloud/aiplatform_v1beta1/types/artifact.py index eea478dfc8..48d931a937 100644 --- a/google/cloud/aiplatform_v1beta1/types/artifact.py +++ b/google/cloud/aiplatform_v1beta1/types/artifact.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/batch_prediction_job.py b/google/cloud/aiplatform_v1beta1/types/batch_prediction_job.py index 892e63c3b2..928793451f 100644 --- a/google/cloud/aiplatform_v1beta1/types/batch_prediction_job.py +++ b/google/cloud/aiplatform_v1beta1/types/batch_prediction_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/cached_content.py b/google/cloud/aiplatform_v1beta1/types/cached_content.py index ba36955c5a..af5df8f5ca 100644 --- a/google/cloud/aiplatform_v1beta1/types/cached_content.py +++ b/google/cloud/aiplatform_v1beta1/types/cached_content.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/completion_stats.py b/google/cloud/aiplatform_v1beta1/types/completion_stats.py index d9342dfbd3..faf7f4c460 100644 --- a/google/cloud/aiplatform_v1beta1/types/completion_stats.py +++ b/google/cloud/aiplatform_v1beta1/types/completion_stats.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/content.py b/google/cloud/aiplatform_v1beta1/types/content.py index 94ff1010c6..cc0ec17877 100644 --- a/google/cloud/aiplatform_v1beta1/types/content.py +++ b/google/cloud/aiplatform_v1beta1/types/content.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/context.py b/google/cloud/aiplatform_v1beta1/types/context.py index b013118112..58cd915881 100644 --- a/google/cloud/aiplatform_v1beta1/types/context.py +++ b/google/cloud/aiplatform_v1beta1/types/context.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/custom_job.py b/google/cloud/aiplatform_v1beta1/types/custom_job.py index 67200dc8cd..f391e56311 100644 --- a/google/cloud/aiplatform_v1beta1/types/custom_job.py +++ b/google/cloud/aiplatform_v1beta1/types/custom_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/data_item.py b/google/cloud/aiplatform_v1beta1/types/data_item.py index cd36482eab..4064b617f3 100644 --- a/google/cloud/aiplatform_v1beta1/types/data_item.py +++ b/google/cloud/aiplatform_v1beta1/types/data_item.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/data_labeling_job.py b/google/cloud/aiplatform_v1beta1/types/data_labeling_job.py index 1491c3db5a..093436e0a7 100644 --- a/google/cloud/aiplatform_v1beta1/types/data_labeling_job.py +++ b/google/cloud/aiplatform_v1beta1/types/data_labeling_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/dataset.py b/google/cloud/aiplatform_v1beta1/types/dataset.py index 40ccda89eb..a5d505aa01 100644 --- a/google/cloud/aiplatform_v1beta1/types/dataset.py +++ b/google/cloud/aiplatform_v1beta1/types/dataset.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/dataset_service.py b/google/cloud/aiplatform_v1beta1/types/dataset_service.py index 671844ceef..ba2cf4c0f2 100644 --- a/google/cloud/aiplatform_v1beta1/types/dataset_service.py +++ b/google/cloud/aiplatform_v1beta1/types/dataset_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/dataset_version.py b/google/cloud/aiplatform_v1beta1/types/dataset_version.py index 22ad7c4223..bac22bc6f3 100644 --- a/google/cloud/aiplatform_v1beta1/types/dataset_version.py +++ b/google/cloud/aiplatform_v1beta1/types/dataset_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/deployed_index_ref.py b/google/cloud/aiplatform_v1beta1/types/deployed_index_ref.py index daa40d2975..420992b293 100644 --- a/google/cloud/aiplatform_v1beta1/types/deployed_index_ref.py +++ b/google/cloud/aiplatform_v1beta1/types/deployed_index_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/deployed_model_ref.py b/google/cloud/aiplatform_v1beta1/types/deployed_model_ref.py index 49b84309fb..2aef676e3a 100644 --- a/google/cloud/aiplatform_v1beta1/types/deployed_model_ref.py +++ b/google/cloud/aiplatform_v1beta1/types/deployed_model_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool.py b/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool.py index ff6e5ee7c3..91c2590d46 100644 --- a/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool.py +++ b/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool_service.py b/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool_service.py index 64bcc8c576..b7ead63776 100644 --- a/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool_service.py +++ b/google/cloud/aiplatform_v1beta1/types/deployment_resource_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/deployment_stage.py b/google/cloud/aiplatform_v1beta1/types/deployment_stage.py index b08a82f10a..9c32701198 100644 --- a/google/cloud/aiplatform_v1beta1/types/deployment_stage.py +++ b/google/cloud/aiplatform_v1beta1/types/deployment_stage.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/encryption_spec.py b/google/cloud/aiplatform_v1beta1/types/encryption_spec.py index 0bcdca257f..f77e345f01 100644 --- a/google/cloud/aiplatform_v1beta1/types/encryption_spec.py +++ b/google/cloud/aiplatform_v1beta1/types/encryption_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/endpoint.py b/google/cloud/aiplatform_v1beta1/types/endpoint.py index 1143973a31..e1fdc1d571 100644 --- a/google/cloud/aiplatform_v1beta1/types/endpoint.py +++ b/google/cloud/aiplatform_v1beta1/types/endpoint.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/endpoint_service.py b/google/cloud/aiplatform_v1beta1/types/endpoint_service.py index 6e06ceb25d..8f4c6bd31e 100644 --- a/google/cloud/aiplatform_v1beta1/types/endpoint_service.py +++ b/google/cloud/aiplatform_v1beta1/types/endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/entity_type.py b/google/cloud/aiplatform_v1beta1/types/entity_type.py index ce682458c1..1854392643 100644 --- a/google/cloud/aiplatform_v1beta1/types/entity_type.py +++ b/google/cloud/aiplatform_v1beta1/types/entity_type.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/env_var.py b/google/cloud/aiplatform_v1beta1/types/env_var.py index d42ad216bd..b898e2196b 100644 --- a/google/cloud/aiplatform_v1beta1/types/env_var.py +++ b/google/cloud/aiplatform_v1beta1/types/env_var.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/evaluated_annotation.py b/google/cloud/aiplatform_v1beta1/types/evaluated_annotation.py index 31bd1b6b7b..4b40725767 100644 --- a/google/cloud/aiplatform_v1beta1/types/evaluated_annotation.py +++ b/google/cloud/aiplatform_v1beta1/types/evaluated_annotation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/evaluation_agent_data.py b/google/cloud/aiplatform_v1beta1/types/evaluation_agent_data.py index 45a2888b25..e30c422229 100644 --- a/google/cloud/aiplatform_v1beta1/types/evaluation_agent_data.py +++ b/google/cloud/aiplatform_v1beta1/types/evaluation_agent_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/evaluation_rubric.py b/google/cloud/aiplatform_v1beta1/types/evaluation_rubric.py index 3a3fd631fb..1c456c7495 100644 --- a/google/cloud/aiplatform_v1beta1/types/evaluation_rubric.py +++ b/google/cloud/aiplatform_v1beta1/types/evaluation_rubric.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/evaluation_service.py b/google/cloud/aiplatform_v1beta1/types/evaluation_service.py index b005a4bd9c..1088fddbac 100644 --- a/google/cloud/aiplatform_v1beta1/types/evaluation_service.py +++ b/google/cloud/aiplatform_v1beta1/types/evaluation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/event.py b/google/cloud/aiplatform_v1beta1/types/event.py index f1127cde36..ff1cda000f 100644 --- a/google/cloud/aiplatform_v1beta1/types/event.py +++ b/google/cloud/aiplatform_v1beta1/types/event.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/example.py b/google/cloud/aiplatform_v1beta1/types/example.py index 2d39aec112..ba22ffc1ce 100644 --- a/google/cloud/aiplatform_v1beta1/types/example.py +++ b/google/cloud/aiplatform_v1beta1/types/example.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/example_store.py b/google/cloud/aiplatform_v1beta1/types/example_store.py index d413c9d5e3..faf9da4d02 100644 --- a/google/cloud/aiplatform_v1beta1/types/example_store.py +++ b/google/cloud/aiplatform_v1beta1/types/example_store.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/example_store_service.py b/google/cloud/aiplatform_v1beta1/types/example_store_service.py index 2a28b4d091..21a4fd161a 100644 --- a/google/cloud/aiplatform_v1beta1/types/example_store_service.py +++ b/google/cloud/aiplatform_v1beta1/types/example_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/execution.py b/google/cloud/aiplatform_v1beta1/types/execution.py index 4184b21bbc..58364ebc01 100644 --- a/google/cloud/aiplatform_v1beta1/types/execution.py +++ b/google/cloud/aiplatform_v1beta1/types/execution.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/explanation.py b/google/cloud/aiplatform_v1beta1/types/explanation.py index b95b6c0edb..cac4b6493c 100644 --- a/google/cloud/aiplatform_v1beta1/types/explanation.py +++ b/google/cloud/aiplatform_v1beta1/types/explanation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/explanation_metadata.py b/google/cloud/aiplatform_v1beta1/types/explanation_metadata.py index e72f58bca4..cec2103c4a 100644 --- a/google/cloud/aiplatform_v1beta1/types/explanation_metadata.py +++ b/google/cloud/aiplatform_v1beta1/types/explanation_metadata.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/extension.py b/google/cloud/aiplatform_v1beta1/types/extension.py index 628422452d..ac0e04441f 100644 --- a/google/cloud/aiplatform_v1beta1/types/extension.py +++ b/google/cloud/aiplatform_v1beta1/types/extension.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/extension_execution_service.py b/google/cloud/aiplatform_v1beta1/types/extension_execution_service.py index 1126556708..40d92affbc 100644 --- a/google/cloud/aiplatform_v1beta1/types/extension_execution_service.py +++ b/google/cloud/aiplatform_v1beta1/types/extension_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/extension_registry_service.py b/google/cloud/aiplatform_v1beta1/types/extension_registry_service.py index 6559430fbf..74384c582c 100644 --- a/google/cloud/aiplatform_v1beta1/types/extension_registry_service.py +++ b/google/cloud/aiplatform_v1beta1/types/extension_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature.py b/google/cloud/aiplatform_v1beta1/types/feature.py index 80f0c8ae7f..47a7544325 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature.py +++ b/google/cloud/aiplatform_v1beta1/types/feature.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_group.py b/google/cloud/aiplatform_v1beta1/types/feature_group.py index 1cf5369ed6..e324c99b83 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_group.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_group.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_monitor.py b/google/cloud/aiplatform_v1beta1/types/feature_monitor.py index 1e753ec0ab..48d193b081 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_monitor.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_monitor.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_monitor_job.py b/google/cloud/aiplatform_v1beta1/types/feature_monitor_job.py index 5c8959fd81..69da10068a 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_monitor_job.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_monitor_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_monitoring_stats.py b/google/cloud/aiplatform_v1beta1/types/feature_monitoring_stats.py index 7fa62c8ada..908725ef62 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_monitoring_stats.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_monitoring_stats.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_online_store.py b/google/cloud/aiplatform_v1beta1/types/feature_online_store.py index ae08f1ce09..13d01c1fe2 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_online_store.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_online_store.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_online_store_admin_service.py b/google/cloud/aiplatform_v1beta1/types/feature_online_store_admin_service.py index 163c9ebc95..aa31d276f5 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_online_store_admin_service.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_online_store_admin_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_online_store_service.py b/google/cloud/aiplatform_v1beta1/types/feature_online_store_service.py index 25fd63e281..2bf2935b8f 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_online_store_service.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_online_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_registry_service.py b/google/cloud/aiplatform_v1beta1/types/feature_registry_service.py index 5abbc62ac3..458c2aac00 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_registry_service.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_selector.py b/google/cloud/aiplatform_v1beta1/types/feature_selector.py index 6ca120578d..e3244cc905 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_selector.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_selector.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_view.py b/google/cloud/aiplatform_v1beta1/types/feature_view.py index a4625fd27b..7e025074ec 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_view.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_view.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/feature_view_sync.py b/google/cloud/aiplatform_v1beta1/types/feature_view_sync.py index 1928c0fe5f..c56f78e24a 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_view_sync.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/featurestore.py b/google/cloud/aiplatform_v1beta1/types/featurestore.py index 771721c0b1..dde48bf627 100644 --- a/google/cloud/aiplatform_v1beta1/types/featurestore.py +++ b/google/cloud/aiplatform_v1beta1/types/featurestore.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/featurestore_monitoring.py b/google/cloud/aiplatform_v1beta1/types/featurestore_monitoring.py index 2c4c6801fa..94f2b12280 100644 --- a/google/cloud/aiplatform_v1beta1/types/featurestore_monitoring.py +++ b/google/cloud/aiplatform_v1beta1/types/featurestore_monitoring.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/featurestore_online_service.py b/google/cloud/aiplatform_v1beta1/types/featurestore_online_service.py index 900d5dcc35..f41e1f31f6 100644 --- a/google/cloud/aiplatform_v1beta1/types/featurestore_online_service.py +++ b/google/cloud/aiplatform_v1beta1/types/featurestore_online_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/featurestore_service.py b/google/cloud/aiplatform_v1beta1/types/featurestore_service.py index ff436ec8f6..af7f9ed886 100644 --- a/google/cloud/aiplatform_v1beta1/types/featurestore_service.py +++ b/google/cloud/aiplatform_v1beta1/types/featurestore_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/gen_ai_cache_service.py b/google/cloud/aiplatform_v1beta1/types/gen_ai_cache_service.py index b9bf309391..a8664a5206 100644 --- a/google/cloud/aiplatform_v1beta1/types/gen_ai_cache_service.py +++ b/google/cloud/aiplatform_v1beta1/types/gen_ai_cache_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/genai_tuning_service.py b/google/cloud/aiplatform_v1beta1/types/genai_tuning_service.py index 1adc3daedd..958f6f8dc9 100644 --- a/google/cloud/aiplatform_v1beta1/types/genai_tuning_service.py +++ b/google/cloud/aiplatform_v1beta1/types/genai_tuning_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/hyperparameter_tuning_job.py b/google/cloud/aiplatform_v1beta1/types/hyperparameter_tuning_job.py index 9cca52a781..bbd7497f50 100644 --- a/google/cloud/aiplatform_v1beta1/types/hyperparameter_tuning_job.py +++ b/google/cloud/aiplatform_v1beta1/types/hyperparameter_tuning_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/index.py b/google/cloud/aiplatform_v1beta1/types/index.py index 2d7a2069c2..4ae7e96e3e 100644 --- a/google/cloud/aiplatform_v1beta1/types/index.py +++ b/google/cloud/aiplatform_v1beta1/types/index.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/index_endpoint.py b/google/cloud/aiplatform_v1beta1/types/index_endpoint.py index 9690069cbc..c2aa3b1558 100644 --- a/google/cloud/aiplatform_v1beta1/types/index_endpoint.py +++ b/google/cloud/aiplatform_v1beta1/types/index_endpoint.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/index_endpoint_service.py b/google/cloud/aiplatform_v1beta1/types/index_endpoint_service.py index 0c350ebc53..e940ff4be1 100644 --- a/google/cloud/aiplatform_v1beta1/types/index_endpoint_service.py +++ b/google/cloud/aiplatform_v1beta1/types/index_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/index_service.py b/google/cloud/aiplatform_v1beta1/types/index_service.py index cac8f389e9..0eabe8af41 100644 --- a/google/cloud/aiplatform_v1beta1/types/index_service.py +++ b/google/cloud/aiplatform_v1beta1/types/index_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/io.py b/google/cloud/aiplatform_v1beta1/types/io.py index 0274af9930..13c8f4e4f5 100644 --- a/google/cloud/aiplatform_v1beta1/types/io.py +++ b/google/cloud/aiplatform_v1beta1/types/io.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/job_service.py b/google/cloud/aiplatform_v1beta1/types/job_service.py index 04f86077e9..8348713f26 100644 --- a/google/cloud/aiplatform_v1beta1/types/job_service.py +++ b/google/cloud/aiplatform_v1beta1/types/job_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/job_state.py b/google/cloud/aiplatform_v1beta1/types/job_state.py index d47eb5e7b8..dd9b13394d 100644 --- a/google/cloud/aiplatform_v1beta1/types/job_state.py +++ b/google/cloud/aiplatform_v1beta1/types/job_state.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/lineage_subgraph.py b/google/cloud/aiplatform_v1beta1/types/lineage_subgraph.py index b3a6b0277c..48120351fe 100644 --- a/google/cloud/aiplatform_v1beta1/types/lineage_subgraph.py +++ b/google/cloud/aiplatform_v1beta1/types/lineage_subgraph.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/llm_utility_service.py b/google/cloud/aiplatform_v1beta1/types/llm_utility_service.py index ec90c364d1..cd93deba95 100644 --- a/google/cloud/aiplatform_v1beta1/types/llm_utility_service.py +++ b/google/cloud/aiplatform_v1beta1/types/llm_utility_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/machine_resources.py b/google/cloud/aiplatform_v1beta1/types/machine_resources.py index 23adf7d0e7..bff3b4b467 100644 --- a/google/cloud/aiplatform_v1beta1/types/machine_resources.py +++ b/google/cloud/aiplatform_v1beta1/types/machine_resources.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/manual_batch_tuning_parameters.py b/google/cloud/aiplatform_v1beta1/types/manual_batch_tuning_parameters.py index 20be03a1e1..9a4cdc42d7 100644 --- a/google/cloud/aiplatform_v1beta1/types/manual_batch_tuning_parameters.py +++ b/google/cloud/aiplatform_v1beta1/types/manual_batch_tuning_parameters.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/match_service.py b/google/cloud/aiplatform_v1beta1/types/match_service.py index 841054cda6..a4611bfb92 100644 --- a/google/cloud/aiplatform_v1beta1/types/match_service.py +++ b/google/cloud/aiplatform_v1beta1/types/match_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/memory_bank.py b/google/cloud/aiplatform_v1beta1/types/memory_bank.py index 4698067040..df06cce454 100644 --- a/google/cloud/aiplatform_v1beta1/types/memory_bank.py +++ b/google/cloud/aiplatform_v1beta1/types/memory_bank.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/memory_bank_service.py b/google/cloud/aiplatform_v1beta1/types/memory_bank_service.py index 13ab468d63..e5ed5b6089 100644 --- a/google/cloud/aiplatform_v1beta1/types/memory_bank_service.py +++ b/google/cloud/aiplatform_v1beta1/types/memory_bank_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/metadata_schema.py b/google/cloud/aiplatform_v1beta1/types/metadata_schema.py index ac1d48d5a0..64c2abeac1 100644 --- a/google/cloud/aiplatform_v1beta1/types/metadata_schema.py +++ b/google/cloud/aiplatform_v1beta1/types/metadata_schema.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/metadata_service.py b/google/cloud/aiplatform_v1beta1/types/metadata_service.py index e22499a20b..a95179cb0d 100644 --- a/google/cloud/aiplatform_v1beta1/types/metadata_service.py +++ b/google/cloud/aiplatform_v1beta1/types/metadata_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/metadata_store.py b/google/cloud/aiplatform_v1beta1/types/metadata_store.py index fcf0f5e577..a36613f9a0 100644 --- a/google/cloud/aiplatform_v1beta1/types/metadata_store.py +++ b/google/cloud/aiplatform_v1beta1/types/metadata_store.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/migratable_resource.py b/google/cloud/aiplatform_v1beta1/types/migratable_resource.py index c4a406baef..d7746c70a1 100644 --- a/google/cloud/aiplatform_v1beta1/types/migratable_resource.py +++ b/google/cloud/aiplatform_v1beta1/types/migratable_resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/migration_service.py b/google/cloud/aiplatform_v1beta1/types/migration_service.py index b6476373c5..b358c67018 100644 --- a/google/cloud/aiplatform_v1beta1/types/migration_service.py +++ b/google/cloud/aiplatform_v1beta1/types/migration_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model.py b/google/cloud/aiplatform_v1beta1/types/model.py index 4ec67a62ed..3f6cb10bed 100644 --- a/google/cloud/aiplatform_v1beta1/types/model.py +++ b/google/cloud/aiplatform_v1beta1/types/model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_deployment_monitoring_job.py b/google/cloud/aiplatform_v1beta1/types/model_deployment_monitoring_job.py index 3896ca40e2..3b10544478 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_deployment_monitoring_job.py +++ b/google/cloud/aiplatform_v1beta1/types/model_deployment_monitoring_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_evaluation.py b/google/cloud/aiplatform_v1beta1/types/model_evaluation.py index de95fdf2dc..e5c1963545 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_evaluation.py +++ b/google/cloud/aiplatform_v1beta1/types/model_evaluation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_evaluation_slice.py b/google/cloud/aiplatform_v1beta1/types/model_evaluation_slice.py index 99006e7817..a708526ef2 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_evaluation_slice.py +++ b/google/cloud/aiplatform_v1beta1/types/model_evaluation_slice.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_garden_service.py b/google/cloud/aiplatform_v1beta1/types/model_garden_service.py index 3389bdff1b..fc9a97cea3 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_garden_service.py +++ b/google/cloud/aiplatform_v1beta1/types/model_garden_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitor.py b/google/cloud/aiplatform_v1beta1/types/model_monitor.py index 855ccfbb64..a63490008b 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitor.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitor.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring.py index 7cd07145c1..22f18c5e8e 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring_alert.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring_alert.py index 69fa127a67..ca4b15b4b7 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring_alert.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring_alert.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring_job.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring_job.py index d102610639..db4a7848e1 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring_job.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring_service.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring_service.py index 1235e9bced..8fb36cabc3 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring_service.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring_spec.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring_spec.py index 1a7a7d8f3f..af409ef22b 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring_spec.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring_stats.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring_stats.py index bbca3c742d..2bec5ab132 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring_stats.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring_stats.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/model_service.py b/google/cloud/aiplatform_v1beta1/types/model_service.py index c8aada7ffe..1d37beaddd 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_service.py +++ b/google/cloud/aiplatform_v1beta1/types/model_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/nas_job.py b/google/cloud/aiplatform_v1beta1/types/nas_job.py index b0d5c6a428..6c19019afb 100644 --- a/google/cloud/aiplatform_v1beta1/types/nas_job.py +++ b/google/cloud/aiplatform_v1beta1/types/nas_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/network_spec.py b/google/cloud/aiplatform_v1beta1/types/network_spec.py index 2560e4e7fb..5c9a8a5777 100644 --- a/google/cloud/aiplatform_v1beta1/types/network_spec.py +++ b/google/cloud/aiplatform_v1beta1/types/network_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_euc_config.py b/google/cloud/aiplatform_v1beta1/types/notebook_euc_config.py index fbb4aa9bb3..fd75d546dc 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_euc_config.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_euc_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py b/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py index 02b5ab2630..c48a14e08a 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_idle_shutdown_config.py b/google/cloud/aiplatform_v1beta1/types/notebook_idle_shutdown_config.py index 325fb37bfc..e9d9f1396b 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_idle_shutdown_config.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_idle_shutdown_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_runtime.py b/google/cloud/aiplatform_v1beta1/types/notebook_runtime.py index 58aefbf564..85ebdd6958 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_runtime.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_runtime.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_runtime_template_ref.py b/google/cloud/aiplatform_v1beta1/types/notebook_runtime_template_ref.py index de4a23d956..870b1a98d4 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_runtime_template_ref.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_runtime_template_ref.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_service.py b/google/cloud/aiplatform_v1beta1/types/notebook_service.py index b01129130a..ac03e25eb6 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_service.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_software_config.py b/google/cloud/aiplatform_v1beta1/types/notebook_software_config.py index 2e340b640d..ba42bd158e 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_software_config.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_software_config.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/online_evaluator.py b/google/cloud/aiplatform_v1beta1/types/online_evaluator.py index 5a69914196..942b051b56 100644 --- a/google/cloud/aiplatform_v1beta1/types/online_evaluator.py +++ b/google/cloud/aiplatform_v1beta1/types/online_evaluator.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/online_evaluator_service.py b/google/cloud/aiplatform_v1beta1/types/online_evaluator_service.py index 4966caf9b7..893400e7cd 100644 --- a/google/cloud/aiplatform_v1beta1/types/online_evaluator_service.py +++ b/google/cloud/aiplatform_v1beta1/types/online_evaluator_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/openapi.py b/google/cloud/aiplatform_v1beta1/types/openapi.py index 6114c26169..f01bdbb654 100644 --- a/google/cloud/aiplatform_v1beta1/types/openapi.py +++ b/google/cloud/aiplatform_v1beta1/types/openapi.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/operation.py b/google/cloud/aiplatform_v1beta1/types/operation.py index a174ee5645..e947381d5a 100644 --- a/google/cloud/aiplatform_v1beta1/types/operation.py +++ b/google/cloud/aiplatform_v1beta1/types/operation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/persistent_resource.py b/google/cloud/aiplatform_v1beta1/types/persistent_resource.py index 1195a5eeeb..bce6d462cd 100644 --- a/google/cloud/aiplatform_v1beta1/types/persistent_resource.py +++ b/google/cloud/aiplatform_v1beta1/types/persistent_resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/persistent_resource_service.py b/google/cloud/aiplatform_v1beta1/types/persistent_resource_service.py index 5c20d0d8b3..62ad9a0f26 100644 --- a/google/cloud/aiplatform_v1beta1/types/persistent_resource_service.py +++ b/google/cloud/aiplatform_v1beta1/types/persistent_resource_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/pipeline_failure_policy.py b/google/cloud/aiplatform_v1beta1/types/pipeline_failure_policy.py index 2902a02c0a..5aee746a0b 100644 --- a/google/cloud/aiplatform_v1beta1/types/pipeline_failure_policy.py +++ b/google/cloud/aiplatform_v1beta1/types/pipeline_failure_policy.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/pipeline_job.py b/google/cloud/aiplatform_v1beta1/types/pipeline_job.py index fb853be141..e5a6b22de9 100644 --- a/google/cloud/aiplatform_v1beta1/types/pipeline_job.py +++ b/google/cloud/aiplatform_v1beta1/types/pipeline_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/pipeline_service.py b/google/cloud/aiplatform_v1beta1/types/pipeline_service.py index 3c8a3a2087..43a5328ab3 100644 --- a/google/cloud/aiplatform_v1beta1/types/pipeline_service.py +++ b/google/cloud/aiplatform_v1beta1/types/pipeline_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/pipeline_state.py b/google/cloud/aiplatform_v1beta1/types/pipeline_state.py index 5ef7a3bb60..c11cb7131c 100644 --- a/google/cloud/aiplatform_v1beta1/types/pipeline_state.py +++ b/google/cloud/aiplatform_v1beta1/types/pipeline_state.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/prediction_service.py b/google/cloud/aiplatform_v1beta1/types/prediction_service.py index e992bb7113..591210848e 100644 --- a/google/cloud/aiplatform_v1beta1/types/prediction_service.py +++ b/google/cloud/aiplatform_v1beta1/types/prediction_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/publisher_model.py b/google/cloud/aiplatform_v1beta1/types/publisher_model.py index 333fe4c304..dbd91aa3df 100644 --- a/google/cloud/aiplatform_v1beta1/types/publisher_model.py +++ b/google/cloud/aiplatform_v1beta1/types/publisher_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/reasoning_engine.py b/google/cloud/aiplatform_v1beta1/types/reasoning_engine.py index 6fb291563f..07c58e831f 100644 --- a/google/cloud/aiplatform_v1beta1/types/reasoning_engine.py +++ b/google/cloud/aiplatform_v1beta1/types/reasoning_engine.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -495,8 +495,103 @@ class ReasoningEngine(proto.Message): will be secured by this key. labels (MutableMapping[str, str]): Labels for the ReasoningEngine. + traffic_config (google.cloud.aiplatform_v1beta1.types.ReasoningEngine.TrafficConfig): + Optional. Traffic distribution configuration + for the Reasoning Engine. """ + class TrafficConfig(proto.Message): + r"""Traffic distribution 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: + traffic_split_manual (google.cloud.aiplatform_v1beta1.types.ReasoningEngine.TrafficConfig.TrafficSplitManual): + Optional. Manual traffic distribution + configuration, where the user specifies the + Runtime Revision IDs and the percentage of + traffic to send to each. + + This field is a member of `oneof`_ ``traffic_split``. + traffic_split_always_latest (google.cloud.aiplatform_v1beta1.types.ReasoningEngine.TrafficConfig.TrafficSplitAlwaysLatest): + Optional. Traffic distribution configuration, + where all traffic is sent to the latest Runtime + Revision. + + This field is a member of `oneof`_ ``traffic_split``. + """ + + class TrafficSplitManual(proto.Message): + r"""Manual traffic distribution configuration, where the user + specifies the Runtime Revision IDs and the percentage of traffic + to send to each. + + Attributes: + targets (MutableSequence[google.cloud.aiplatform_v1beta1.types.ReasoningEngine.TrafficConfig.TrafficSplitManual.Target]): + A list of traffic targets for the Runtimes + Revisions. The sum of percentages must equal to + 100. + """ + + class Target(proto.Message): + r"""A single target for the traffic split, specifying a Runtime + Revision and the percentage of traffic to send to it. + + Attributes: + runtime_revision_name (str): + Required. The Runtime Revision name to which + to send this portion of traffic, if traffic + allocation is by Runtime Revision. + percent (int): + Required. Specifies percent of the traffic to + this Runtime Revision. + """ + + runtime_revision_name: str = proto.Field( + proto.STRING, + number=1, + ) + percent: int = proto.Field( + proto.INT32, + number=2, + ) + + targets: MutableSequence[ + "ReasoningEngine.TrafficConfig.TrafficSplitManual.Target" + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ReasoningEngine.TrafficConfig.TrafficSplitManual.Target", + ) + + class TrafficSplitAlwaysLatest(proto.Message): + r"""Traffic distribution configuration, where all traffic is sent + to the latest Runtime Revision. + + """ + + traffic_split_manual: "ReasoningEngine.TrafficConfig.TrafficSplitManual" = ( + proto.Field( + proto.MESSAGE, + number=18, + oneof="traffic_split", + message="ReasoningEngine.TrafficConfig.TrafficSplitManual", + ) + ) + traffic_split_always_latest: ( + "ReasoningEngine.TrafficConfig.TrafficSplitAlwaysLatest" + ) = proto.Field( + proto.MESSAGE, + number=19, + oneof="traffic_split", + message="ReasoningEngine.TrafficConfig.TrafficSplitAlwaysLatest", + ) + name: str = proto.Field( proto.STRING, number=1, @@ -543,6 +638,11 @@ class ReasoningEngine(proto.Message): proto.STRING, number=17, ) + traffic_config: TrafficConfig = proto.Field( + proto.MESSAGE, + number=20, + message=TrafficConfig, + ) class ReasoningEngineContextSpec(proto.Message): diff --git a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_execution_service.py b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_execution_service.py index 7560198ed4..049012f854 100644 --- a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_execution_service.py +++ b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ "AsyncQueryReasoningEngineRequest", "AsyncQueryReasoningEngineOperationMetadata", "AsyncQueryReasoningEngineResponse", + "CancelAsyncQueryReasoningEngineRequest", + "CancelAsyncQueryReasoningEngineResponse", }, ) @@ -179,4 +181,36 @@ class AsyncQueryReasoningEngineResponse(proto.Message): ) +class CancelAsyncQueryReasoningEngineRequest(proto.Message): + r"""Request message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + Attributes: + name (str): + Required. The name of the ReasoningEngine resource to use. + Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`` + operation_name (str): + Required. The name of the longrunning operation returned + from AsyncQueryReasoningEngine. Format: + ``projects/{project}/locations/{location}/operations/{operation}`` + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + operation_name: str = proto.Field( + proto.STRING, + number=2, + ) + + +class CancelAsyncQueryReasoningEngineResponse(proto.Message): + r"""Response message for + [ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine][google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine]. + + """ + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision.py b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision.py new file mode 100644 index 0000000000..ab3c638607 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 __future__ import annotations + +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.cloud.aiplatform_v1beta1.types import reasoning_engine +import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.aiplatform.v1beta1", + manifest={ + "ReasoningEngineRuntimeRevision", + }, +) + + +class ReasoningEngineRuntimeRevision(proto.Message): + r"""ReasoningEngineRuntimeRevision is a specific version of the + runtime related part of ReasoningEngine. Contains only the + fields that are revision specific. + + Attributes: + name (str): + Identifier. The resource name of the + ReasoningEngineRuntimeRevision. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}`` + spec (google.cloud.aiplatform_v1beta1.types.ReasoningEngineSpec): + Immutable. Configurations of the + ReasoningEngineRuntimeRevision. Contains only + revision specific fields. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Timestamp when this + ReasoningEngineRuntimeRevision was created. + state (google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision.State): + Output only. The state of the revision. + """ + + class State(proto.Enum): + r"""Possible values of the state of the revision. + + Values: + STATE_UNSPECIFIED (0): + The unspecified state. + ACTIVE (1): + Is deployed and ready to be used. + DEPRECATED (2): + Is deprecated, may not be used, only + preserved for historical purposes. + """ + + STATE_UNSPECIFIED = 0 + ACTIVE = 1 + DEPRECATED = 2 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + spec: reasoning_engine.ReasoningEngineSpec = proto.Field( + proto.MESSAGE, + number=3, + message=reasoning_engine.ReasoningEngineSpec, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + state: State = proto.Field( + proto.ENUM, + number=5, + enum=State, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision_service.py b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision_service.py new file mode 100644 index 0000000000..1798f26076 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_runtime_revision_service.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 __future__ import annotations + +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.cloud.aiplatform_v1beta1.types import operation +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision + + +__protobuf__ = proto.module( + package="google.cloud.aiplatform.v1beta1", + manifest={ + "DeleteReasoningEngineRuntimeRevisionOperationMetadata", + "GetReasoningEngineRuntimeRevisionRequest", + "ListReasoningEngineRuntimeRevisionsRequest", + "ListReasoningEngineRuntimeRevisionsResponse", + "DeleteReasoningEngineRuntimeRevisionRequest", + }, +) + + +class DeleteReasoningEngineRuntimeRevisionOperationMetadata(proto.Message): + r"""Metadata associated with DeleteReasoningEngineRuntimeRevision + operation. + + Attributes: + generic_metadata (google.cloud.aiplatform_v1beta1.types.GenericOperationMetadata): + The common part of the operation metadata. + """ + + generic_metadata: operation.GenericOperationMetadata = proto.Field( + proto.MESSAGE, + number=1, + message=operation.GenericOperationMetadata, + ) + + +class GetReasoningEngineRuntimeRevisionRequest(proto.Message): + r"""Request message for + [ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision]. + + Attributes: + name (str): + Required. The name of the ReasoningEngineRuntimeRevision + resource. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtimeRevision}`` + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListReasoningEngineRuntimeRevisionsRequest(proto.Message): + r"""Request message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions]. + + Attributes: + parent (str): + Required. The resource name of the ReasoningEngine to list + the ReasoningEngineRuntimeRevisions from. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`` + filter (str): + Optional. The standard list filter. More detail in + `AIP-160 `__. + page_size (int): + Optional. The maximum number of + ReasoningEngineRuntimeRevisions to return. The + service may return fewer than this value. + + If unspecified, at most 50 revisions will be + returned. + + The maximum value is 100; values above 100 will + be coerced to 100. + page_token (str): + Optional. The standard list page token. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + filter: str = proto.Field( + proto.STRING, + number=2, + ) + page_size: int = proto.Field( + proto.INT32, + number=3, + ) + page_token: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListReasoningEngineRuntimeRevisionsResponse(proto.Message): + r"""Response message for + [ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions] + + Attributes: + reasoning_engine_runtime_revisions (MutableSequence[google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision]): + List of ReasoningEngineRuntimeRevisions in + the requested page. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListReasoningEngineRuntimeRevisionsRequest.page_token][google.cloud.aiplatform.v1beta1.ListReasoningEngineRuntimeRevisionsRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + reasoning_engine_runtime_revisions: MutableSequence[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class DeleteReasoningEngineRuntimeRevisionRequest(proto.Message): + r"""Request message for + [ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision][google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision]. + + Attributes: + name (str): + Required. The name of the ReasoningEngineRuntimeRevision + resource to be deleted. Format: + ``projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}`` + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_service.py b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_service.py index 737660721c..f534a9df4c 100644 --- a/google/cloud/aiplatform_v1beta1/types/reasoning_engine_service.py +++ b/google/cloud/aiplatform_v1beta1/types/reasoning_engine_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/reservation_affinity.py b/google/cloud/aiplatform_v1beta1/types/reservation_affinity.py index 20f972a36a..e311ccc5af 100644 --- a/google/cloud/aiplatform_v1beta1/types/reservation_affinity.py +++ b/google/cloud/aiplatform_v1beta1/types/reservation_affinity.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/saved_query.py b/google/cloud/aiplatform_v1beta1/types/saved_query.py index caf6533b40..85bede84ad 100644 --- a/google/cloud/aiplatform_v1beta1/types/saved_query.py +++ b/google/cloud/aiplatform_v1beta1/types/saved_query.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/schedule.py b/google/cloud/aiplatform_v1beta1/types/schedule.py index cffd911251..6e45912ff7 100644 --- a/google/cloud/aiplatform_v1beta1/types/schedule.py +++ b/google/cloud/aiplatform_v1beta1/types/schedule.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/schedule_service.py b/google/cloud/aiplatform_v1beta1/types/schedule_service.py index 7863472be5..66659bff90 100644 --- a/google/cloud/aiplatform_v1beta1/types/schedule_service.py +++ b/google/cloud/aiplatform_v1beta1/types/schedule_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/service_networking.py b/google/cloud/aiplatform_v1beta1/types/service_networking.py index 55003b03ac..bade164f76 100644 --- a/google/cloud/aiplatform_v1beta1/types/service_networking.py +++ b/google/cloud/aiplatform_v1beta1/types/service_networking.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/session.py b/google/cloud/aiplatform_v1beta1/types/session.py index a665cb5bb3..b0795af298 100644 --- a/google/cloud/aiplatform_v1beta1/types/session.py +++ b/google/cloud/aiplatform_v1beta1/types/session.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/session_service.py b/google/cloud/aiplatform_v1beta1/types/session_service.py index be67687627..9c4304ec52 100644 --- a/google/cloud/aiplatform_v1beta1/types/session_service.py +++ b/google/cloud/aiplatform_v1beta1/types/session_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/specialist_pool.py b/google/cloud/aiplatform_v1beta1/types/specialist_pool.py index 91a79f3b8f..3b18422bc3 100644 --- a/google/cloud/aiplatform_v1beta1/types/specialist_pool.py +++ b/google/cloud/aiplatform_v1beta1/types/specialist_pool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/specialist_pool_service.py b/google/cloud/aiplatform_v1beta1/types/specialist_pool_service.py index d9ae174344..e33563a835 100644 --- a/google/cloud/aiplatform_v1beta1/types/specialist_pool_service.py +++ b/google/cloud/aiplatform_v1beta1/types/specialist_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/study.py b/google/cloud/aiplatform_v1beta1/types/study.py index 0cf71a112e..4ec28f6cf8 100644 --- a/google/cloud/aiplatform_v1beta1/types/study.py +++ b/google/cloud/aiplatform_v1beta1/types/study.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard.py b/google/cloud/aiplatform_v1beta1/types/tensorboard.py index 60cbc3be23..117800e330 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard_data.py b/google/cloud/aiplatform_v1beta1/types/tensorboard_data.py index d6f4211817..7c31d5b080 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard_data.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard_experiment.py b/google/cloud/aiplatform_v1beta1/types/tensorboard_experiment.py index 6ea65040b6..b94849f7eb 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard_experiment.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard_experiment.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard_run.py b/google/cloud/aiplatform_v1beta1/types/tensorboard_run.py index 80e8929891..85d415bf85 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard_run.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard_run.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard_service.py b/google/cloud/aiplatform_v1beta1/types/tensorboard_service.py index 87e527b846..f7ad952ef2 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard_service.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard_time_series.py b/google/cloud/aiplatform_v1beta1/types/tensorboard_time_series.py index 7292ce9311..43d141a764 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard_time_series.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard_time_series.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tool.py b/google/cloud/aiplatform_v1beta1/types/tool.py index 3f06b93484..ae66e88303 100644 --- a/google/cloud/aiplatform_v1beta1/types/tool.py +++ b/google/cloud/aiplatform_v1beta1/types/tool.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -97,6 +97,12 @@ class Tool(proto.Message): Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. + parallel_ai_search (google.cloud.aiplatform_v1beta1.types.Tool.ParallelAiSearch): + Optional. If specified, Vertex AI will use + Parallel.ai to search for information to answer + user queries. The search results will be + grounded on Parallel.ai and presented to the + model for response generation code_execution (google.cloud.aiplatform_v1beta1.types.Tool.CodeExecution): Optional. CodeExecution tool type. Enables the model to execute code as part of @@ -179,6 +185,44 @@ class GoogleSearch(proto.Message): enum="Tool.PhishBlockThreshold", ) + class ParallelAiSearch(proto.Message): + r"""ParallelAiSearch tool type. + A tool that uses the Parallel.ai search engine for grounding. + + Attributes: + api_key (str): + Optional. The API key for ParallelAiSearch. + If an API key is not provided, the system will + attempt to verify access by checking for an + active Parallel.ai subscription through the + Google Cloud Marketplace. + See + https://docs.parallel.ai/search/search-quickstart + for more details. + custom_configs (google.protobuf.struct_pb2.Struct): + Optional. Custom configs for ParallelAiSearch. This field + can be used to pass any parameter from the Parallel.ai + Search API. See the Parallel.ai documentation for the full + list of available parameters and their usage: + https://docs.parallel.ai/api-reference/search-beta/search + Currently only ``source_policy``, ``excerpts``, + ``max_results``, ``mode``, ``fetch_policy`` can be set via + this field. For example: { "source_policy": { + "include_domains": ["google.com", "wikipedia.org"], + "exclude_domains": ["example.com"] }, "fetch_policy": { + "max_age_seconds": 3600 } } + """ + + api_key: str = proto.Field( + proto.STRING, + number=1, + ) + custom_configs: struct_pb2.Struct = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) + class CodeExecution(proto.Message): r"""Tool that executes code generated by the model, and automatically returns the result to the model. @@ -260,6 +304,11 @@ class Environment(proto.Enum): number=6, message="EnterpriseWebSearch", ) + parallel_ai_search: ParallelAiSearch = proto.Field( + proto.MESSAGE, + number=13, + message=ParallelAiSearch, + ) code_execution: CodeExecution = proto.Field( proto.MESSAGE, number=4, diff --git a/google/cloud/aiplatform_v1beta1/types/training_pipeline.py b/google/cloud/aiplatform_v1beta1/types/training_pipeline.py index c8bd44b937..4989468a48 100644 --- a/google/cloud/aiplatform_v1beta1/types/training_pipeline.py +++ b/google/cloud/aiplatform_v1beta1/types/training_pipeline.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/tuning_job.py b/google/cloud/aiplatform_v1beta1/types/tuning_job.py index 5ab994ff84..9102b4bd98 100644 --- a/google/cloud/aiplatform_v1beta1/types/tuning_job.py +++ b/google/cloud/aiplatform_v1beta1/types/tuning_job.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/types.py b/google/cloud/aiplatform_v1beta1/types/types.py index 90c3ba7f52..cf48467be2 100644 --- a/google/cloud/aiplatform_v1beta1/types/types.py +++ b/google/cloud/aiplatform_v1beta1/types/types.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py b/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py index 4530cdc3d8..f4bbb6cc77 100644 --- a/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py +++ b/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/unmanaged_container_model.py b/google/cloud/aiplatform_v1beta1/types/unmanaged_container_model.py index ddf692f994..6e244da904 100644 --- a/google/cloud/aiplatform_v1beta1/types/unmanaged_container_model.py +++ b/google/cloud/aiplatform_v1beta1/types/unmanaged_container_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/usage_metadata.py b/google/cloud/aiplatform_v1beta1/types/usage_metadata.py index 7d62068076..f1da3cd183 100644 --- a/google/cloud/aiplatform_v1beta1/types/usage_metadata.py +++ b/google/cloud/aiplatform_v1beta1/types/usage_metadata.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/user_action_reference.py b/google/cloud/aiplatform_v1beta1/types/user_action_reference.py index 27cf6200cc..405d112125 100644 --- a/google/cloud/aiplatform_v1beta1/types/user_action_reference.py +++ b/google/cloud/aiplatform_v1beta1/types/user_action_reference.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/value.py b/google/cloud/aiplatform_v1beta1/types/value.py index c6eceb6386..a4b2e8378c 100644 --- a/google/cloud/aiplatform_v1beta1/types/value.py +++ b/google/cloud/aiplatform_v1beta1/types/value.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py index 915e79e4b8..a5b130069b 100644 --- a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py +++ b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data_service.py b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data_service.py index b377b53a7b..6fc0d25f8c 100644 --- a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data_service.py +++ b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/vertex_rag_service.py b/google/cloud/aiplatform_v1beta1/types/vertex_rag_service.py index c70d429ef4..9cf5670ae4 100644 --- a/google/cloud/aiplatform_v1beta1/types/vertex_rag_service.py +++ b/google/cloud/aiplatform_v1beta1/types/vertex_rag_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/aiplatform_v1beta1/types/vizier_service.py b/google/cloud/aiplatform_v1beta1/types/vizier_service.py index bfbae4f55c..2d8666c3cf 100644 --- a/google/cloud/aiplatform_v1beta1/types/vizier_service.py +++ b/google/cloud/aiplatform_v1beta1/types/vizier_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_async.py b/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_async.py index ce1ce56405..0aec7a818e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_sync.py index 7182db967b..5eb389f05b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_data_foundry_service_generate_synthetic_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_async.py index 52386f04ea..f55df60c3a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_dataset(): ) # Make the request - operation = client.create_dataset(request=request) + operation = await client.create_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_sync.py index cf8b0426b6..1fc6655f4e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_async.py index df675602eb..bb37d36b3d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_dataset_version(): ) # Make the request - operation = client.create_dataset_version(request=request) + operation = await client.create_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_sync.py index e6d75fb95e..a0e259143e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_create_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_async.py index 84e3512207..ab26c67d01 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_dataset(): ) # Make the request - operation = client.delete_dataset(request=request) + operation = await client.delete_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_sync.py index 5988eeb06b..c1d2bc2117 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_async.py index 773fb154bc..a05e3f8559 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_dataset_version(): ) # Make the request - operation = client.delete_dataset_version(request=request) + operation = await client.delete_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_sync.py index f8ea3f0618..4faad41da4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_async.py index 0ebfc457cc..681b4eb8a9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_saved_query(): ) # Make the request - operation = client.delete_saved_query(request=request) + operation = await client.delete_saved_query(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_sync.py index 31bef6197c..bf0052e957 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_delete_saved_query_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_async.py index f20b744ecd..1fce1d14cc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_export_data(): ) # Make the request - operation = client.export_data(request=request) + operation = await client.export_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_sync.py index 58f6eb37ed..b5267c0b63 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_export_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_async.py index 249c158161..bee52cdf77 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_sync.py index 06622a5009..037dd2cf2a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_annotation_spec_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_async.py index 430bcbde31..e53660de01 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_sync.py index d654d9cabf..7d9cdb7cf3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_async.py index 56b11adf87..92aa800d03 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_sync.py index c147a4e19d..4360aa0aa0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_get_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_async.py index 3c126ae857..98687cab6e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_import_data(): ) # Make the request - operation = client.import_data(request=request) + operation = await client.import_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_sync.py index 5beaa619c8..de2c92da66 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_import_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_async.py index 5ee2c927f2..6e04f30d39 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_sync.py index a767b47492..e908b4fb56 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_annotations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_async.py index ffc3f31dfe..2bfc530deb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_sync.py index 0744c28ace..acc5b52090 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_data_items_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_async.py index fcbdf45c13..bbafdddf91 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_sync.py index a2e41a75dc..5316c09716 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_dataset_versions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_async.py index 6a3bc2fc35..bb56bb9b3a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_sync.py index 47b8375b46..ce318fc04c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_datasets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_async.py index cdbe64f1f4..49a36d2872 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_sync.py index 514eaa14ad..4e1db7d1dd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_list_saved_queries_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_async.py index bbe45bdc06..fa1d2f7b2f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_restore_dataset_version(): ) # Make the request - operation = client.restore_dataset_version(request=request) + operation = await client.restore_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_sync.py index 8dfea72dd4..de9d40fe30 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_restore_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_async.py index 84bc5e2e4a..f1981b0dad 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_sync.py index 24808837c5..e1fe13e5ff 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_search_data_items_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_async.py index 07e7bd205a..90520e1fb6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_sync.py index 70a5f5a66d..504ecbe2bb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_async.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_async.py index 34ba94776a..1d58ed01e8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_sync.py index b86c59ed9a..123097207b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_dataset_service_update_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py index 476dd5ec90..b1046cb748 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_deployment_resource_pool(): ) # Make the request - operation = client.create_deployment_resource_pool(request=request) + operation = await client.create_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py index 7491816204..472252151d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py index 3bfcb5e649..79c2672327 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_deployment_resource_pool(): ) # Make the request - operation = client.delete_deployment_resource_pool(request=request) + operation = await client.delete_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py index e9c9d59e0c..d35a721e5d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py index c4da8b6354..dc92b96fba 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py index 460b290cb3..b0eb5126f9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py index 226bf700e0..429009600e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py index 118f24e9ec..a972ab60d9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_async.py index a279963bfb..21652f0343 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_sync.py index 19571eeef0..4d4248cfc4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_query_deployed_models_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py index 69c68a16d2..60abbd732e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_deployment_resource_pool(): ) # Make the request - operation = client.update_deployment_resource_pool(request=request) + operation = await client.update_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py index c622d59990..8d8d40afb2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_async.py index 788312e348..2cae621b46 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_endpoint(): ) # Make the request - operation = client.create_endpoint(request=request) + operation = await client.create_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_sync.py index 7b63b0e634..8445de2f3d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_create_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_async.py index 44be3dceda..52472decdc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_endpoint(): ) # Make the request - operation = client.delete_endpoint(request=request) + operation = await client.delete_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_sync.py index 2c717cb5a5..1ce2f1c896 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_delete_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_async.py index 63de02bbfc..3e79bdb387 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_deploy_model(): ) # Make the request - operation = client.deploy_model(request=request) + operation = await client.deploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_sync.py index b7b996203b..7ecbebc219 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_deploy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_async.py index 9ca56c8f34..883d516f7a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_sync.py index f62677eff8..adbadbcc2e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_get_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_async.py index a3df041978..6f187c506c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_sync.py index 4f69b3a931..d0a66eb611 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_list_endpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_async.py index 46b8404345..55b148226b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_mutate_deployed_model(): ) # Make the request - operation = client.mutate_deployed_model(request=request) + operation = await client.mutate_deployed_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_sync.py index 8b51de32b5..18c30e3346 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_mutate_deployed_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_async.py index 2b8481a3bf..30ba5a2963 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_undeploy_model(): ) # Make the request - operation = client.undeploy_model(request=request) + operation = await client.undeploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_sync.py index 7ef51b808d..ceeb7a2e93 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_undeploy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_async.py index 3b3c108dbd..6776e47995 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_async.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_async.py index 743e1ee70d..1b988c4ca1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_endpoint_long_running(): ) # Make the request - operation = client.update_endpoint_long_running(request=request) + operation = await client.update_endpoint_long_running(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_sync.py index 6b73dfea6a..6ba00ce3cd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_long_running_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_sync.py index 425cc27d16..0591fb53c0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_endpoint_service_update_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_async.py b/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_async.py index 54e4006945..ba3cc92e84 100644 --- a/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_sync.py b/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_sync.py index 890e7b4a08..2948b4e0cd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_evaluation_service_evaluate_instances_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_async.py index b0d34ee41a..9eada16b90 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_feature_online_store(): ) # Make the request - operation = client.create_feature_online_store(request=request) + operation = await client.create_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py index b9e69b536d..f75d63330a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_async.py index 0a1945e9d8..afc280f9ce 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_feature_view(): ) # Make the request - operation = client.create_feature_view(request=request) + operation = await client.create_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_sync.py index db46c29cdc..941f16f239 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_create_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py index 2c42301cda..0125add356 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_online_store(): ) # Make the request - operation = client.delete_feature_online_store(request=request) + operation = await client.delete_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py index 7bf00318fc..2f29b02078 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_async.py index 6291631f02..47158cbc69 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_view(): ) # Make the request - operation = client.delete_feature_view(request=request) + operation = await client.delete_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_sync.py index 70c200d56b..eb129e2563 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_delete_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_async.py index 4a2746f271..d8aa4aa98e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py index 374c910c3f..39639919d4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_async.py index 13ba9d9fde..011947a526 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync.py index 229fed7991..493253db1e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py index a4f695ea10..139815ac9c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py index a5b8033f6c..dbdadca766 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py index b8dced18f0..f67b424b4b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py index 5726f01114..6c6c2457a6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py index 8aaa9bdd6b..99785faa51 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py index ba40c22c5b..ef4ce727f1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_async.py index 7e30bdf815..bc59caa2e7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_sync.py index 0886f7d3c0..d1b17317c6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_list_feature_views_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_async.py index ae999aa7fe..e4112d6923 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_sync.py index 653ef6d5e4..034b4204e7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_sync_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_async.py index 133054f779..d0b9288c08 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_feature_online_store(): ) # Make the request - operation = client.update_feature_online_store(request=request) + operation = await client.update_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py index 1b67dcf4fa..4220c73efb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_async.py index c1d503b2a8..d7cde45263 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_feature_view(): ) # Make the request - operation = client.update_feature_view(request=request) + operation = await client.update_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_sync.py index d82755e78c..e167e54972 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_admin_service_update_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_async.py index 406ab3fcbb..35f6d275fb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_sync.py index 6f47aebf1d..d8939c1a3c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_feature_view_direct_write_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_async.py index 703933841c..4653eb42df 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_sync.py index 995f718543..82552df44b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_fetch_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_async.py index 3807701760..af30b72b57 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_sync.py index d8f7245bff..046abc03ec 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_generate_fetch_access_token_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_async.py index 8403d158a0..3c61e42278 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_sync.py index 5c17afad5a..cbf1915ef2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_online_store_service_search_nearest_entities_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_async.py index 2b9428772a..65a010cd06 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_sync.py index 61994b5d1e..fb65e1da58 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_batch_create_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_async.py index 3c5adf9429..dd4844a7bf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_async.py index 88ea651e05..9e2ea21c5d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_feature_group(): ) # Make the request - operation = client.create_feature_group(request=request) + operation = await client.create_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_sync.py index 1d6d0be8e7..6d63f85c24 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_sync.py index 7bdc9f62d7..d0c3925bc6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_create_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_async.py index 8b080775d3..34b55827af 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_async.py index 7f346a919f..0ca32f24ed 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_group(): ) # Make the request - operation = client.delete_feature_group(request=request) + operation = await client.delete_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_sync.py index 2bae047dcd..28c0d2f158 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_sync.py index ab44180c71..9291800c7c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_delete_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_async.py index 90bd172170..c433a823f6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_async.py index 939d2f664a..8361c71735 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_sync.py index 4a4c182692..5c5516bb1a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_sync.py index 501125901e..3201456dbb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_get_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_async.py index 486054234c..c4cbea50b6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_sync.py index 7cb402d3a7..f2c5a37baa 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_feature_groups_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_async.py index 23fcd67c54..d3c3d41dd9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_sync.py index 2bea2ef453..e7f5fada7a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_list_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_async.py index 824706a585..fd6d19f588 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_feature(): ) # Make the request - operation = client.update_feature(request=request) + operation = await client.update_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_async.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_async.py index b2ccf8eb55..c73ec6e211 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_feature_group(): ) # Make the request - operation = client.update_feature_group(request=request) + operation = await client.update_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_sync.py index d0d1363fa6..f9335a3c42 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_sync.py index ea1bbe514f..347744d378 100644 --- a/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_feature_registry_service_update_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_async.py index f244fa80fb..0f48986370 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_sync.py index c82c7db29a..1e19389cac 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py index 6a856e7e52..22522fb209 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py index d05424edc2..073eb670a6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_async.py index f94a0a1de3..7228ff4ad1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_sync.py index f10ab4a43c..3fd725c3c3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_online_serving_service_write_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_async.py index d19d403f8b..1c47412f2e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_sync.py index 48dbef2fbf..95e0969264 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_create_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_async.py index 51ef6e4f2f..4d28e2724a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,11 +57,11 @@ async def sample_batch_read_feature_values(): ) # Make the request - operation = client.batch_read_feature_values(request=request) + operation = await client.batch_read_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_sync.py index 687137d265..d6556e9f89 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_batch_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_async.py index 8dd7dd9017..d7d0cc2cc4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_entity_type(): ) # Make the request - operation = client.create_entity_type(request=request) + operation = await client.create_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_sync.py index b66808f01a..8e8e0537f6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_async.py index 9d40d853d8..2f6fc357a4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_sync.py index f8793b5114..f17bf791f8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_async.py index 3d66e00245..ec7e51fee4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_featurestore(): ) # Make the request - operation = client.create_featurestore(request=request) + operation = await client.create_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_sync.py index 200e72134e..09baeaba19 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_create_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_async.py index 8deed0417d..ca3e32ed0f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_entity_type(): ) # Make the request - operation = client.delete_entity_type(request=request) + operation = await client.delete_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_sync.py index b21c6d1bbe..3afb23649c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_async.py index 92898d73f2..532aca2222 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_sync.py index 90e3594669..5d2ed81634 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_async.py index 4341147a71..a83244b439 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_delete_feature_values(): ) # Make the request - operation = client.delete_feature_values(request=request) + operation = await client.delete_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_sync.py index 37f210bd34..f8bcf8af85 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_async.py index d3c7ddbb01..3a411810ed 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_featurestore(): ) # Make the request - operation = client.delete_featurestore(request=request) + operation = await client.delete_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_sync.py index 552df55489..35bb5072b8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_delete_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_async.py index c27da4c562..1b9b951094 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,11 +52,11 @@ async def sample_export_feature_values(): ) # Make the request - operation = client.export_feature_values(request=request) + operation = await client.export_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_sync.py index fc4b530337..d8a3a67338 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_export_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_async.py index c7497cb891..7531d01c39 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_sync.py index e79425a238..1a7376e278 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_async.py index 3eab9135ac..19f43316c0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_sync.py index cbe889bc77..e4dc766a94 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_async.py index 7aba1847dc..26c4cc6273 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_sync.py index 6dff34a35f..cce9137768 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_get_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_async.py index 212a76e164..8cf6987124 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -53,11 +53,11 @@ async def sample_import_feature_values(): ) # Make the request - operation = client.import_feature_values(request=request) + operation = await client.import_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_sync.py index 055394f67d..694ac244fd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_import_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_async.py index 3d04fba22b..10e500140e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_sync.py index d2f7c0fb37..886d3030ca 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_entity_types_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_async.py index 04e98a7f79..e944f2591f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_sync.py index bbe457902a..3f8a66cdc6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_async.py index 14f8fd3054..f46ab78f5f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_sync.py index 878f32e4bd..51b0791f48 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_list_featurestores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_async.py index c1949dc546..ddf755b5cf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_sync.py index b11791bda7..c8e0aed899 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_search_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_async.py index 4776be5087..b47a6bd968 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_sync.py index f350bce2cd..d54f3302fb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_async.py index 80029bd00c..5053146262 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_sync.py index efed41ff81..e2381e4984 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_async.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_async.py index 2b0e36fca7..3b859bdc40 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_featurestore(): ) # Make the request - operation = client.update_featurestore(request=request) + operation = await client.update_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_sync.py b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_sync.py index 28697851e9..9d1ba9a025 100644 --- a/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_featurestore_service_update_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_async.py index d501183707..a334ab124e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_sync.py index 296f61d112..9c608aba3f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_create_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_async.py index 69ca180c0b..1a037e10b2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_sync.py index 234d13b33c..8599a7cc61 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_delete_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_async.py index 48650a56bf..c8913c908f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_sync.py index 73d00bf950..8f3c995e5e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_get_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_async.py index 151585d27f..0a8dee0861 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_sync.py index 2d74cb532c..8702fc8e9b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_list_cached_contents_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_async.py index 2ffb6cfd71..c2c6ddaca8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_sync.py index d8d441fdef..c9c93a604f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_cache_service_update_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py index 9ab1bf0217..f221568d0f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py index c4e3ce8e87..e8c92ac052 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_async.py index d337427c89..d58b891556 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_sync.py index 5306732b17..84299e2cd2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_create_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_async.py index 92bd9f8259..00f88e349c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_sync.py index 82093bc85f..55f01dbbd7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_get_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py index ec6995275f..07184a6f2d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py index 9ccca6724c..dddd4a5cba 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py index fe724dbc99..efc1111d5a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_rebase_tuned_model(): ) # Make the request - operation = client.rebase_tuned_model(request=request) + operation = await client.rebase_tuned_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py index 3fa8ea55b6..82a6264afa 100644 --- a/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_async.py index 5daf1f2d0d..4f95881d72 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_index_endpoint(): ) # Make the request - operation = client.create_index_endpoint(request=request) + operation = await client.create_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_sync.py index d583559f39..2e87325f82 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_create_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_async.py index 4a2f99a42f..58021e0755 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_index_endpoint(): ) # Make the request - operation = client.delete_index_endpoint(request=request) + operation = await client.delete_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_sync.py index bdcf2135c9..bfbda44869 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_delete_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_async.py index 5de95d4a71..103c5d52c7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_deploy_index(): ) # Make the request - operation = client.deploy_index(request=request) + operation = await client.deploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_sync.py index f9893cb77c..bad45e68ef 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_deploy_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_async.py index 30587b9040..381a89a996 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_sync.py index 4bf0d7857d..242a83690c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_get_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_async.py index ec4988732c..e8e609dc14 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_sync.py index 47a4ae4a5e..111fdb626f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_list_index_endpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_async.py index 55c709bd0c..ed49b931f4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_mutate_deployed_index(): ) # Make the request - operation = client.mutate_deployed_index(request=request) + operation = await client.mutate_deployed_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_sync.py index 9e8b2b31e7..e8245dd258 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_mutate_deployed_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_async.py index 0073d261a6..025364cae2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_undeploy_index(): ) # Make the request - operation = client.undeploy_index(request=request) + operation = await client.undeploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_sync.py index 1a9469ae51..8f4b081d88 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_undeploy_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_async.py index b45aba10f8..70309ea8b4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_sync.py index 3968cb15d5..3e943b5821 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_endpoint_service_update_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_async.py index 99a2f7f782..95c6e6873d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_index(): ) # Make the request - operation = client.create_index(request=request) + operation = await client.create_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_sync.py index 80c019a018..ef885677b9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_create_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_async.py index 57998e1bc2..b9170905c6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_index(): ) # Make the request - operation = client.delete_index(request=request) + operation = await client.delete_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_sync.py index c6b6a9570d..4565a0c5b0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_delete_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_async.py index f046ae7162..e0736516a5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_sync.py index 930e929f5f..689a290f00 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_get_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_async.py index 2ea355f431..84b8a4b464 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_sync.py index 8109db2729..6765194982 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_list_indexes_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_async.py index 183f6a8d5c..c1f6c5016f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_sync.py index f97a07893f..211c95d125 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_remove_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_async.py index 6fedf3f261..e33f3e22d5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_index(): ) # Make the request - operation = client.update_index(request=request) + operation = await client.update_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_sync.py index c7f171bb0e..c2efc4b5cb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_update_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_async.py b/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_async.py index 36d970598e..690800487e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_sync.py index d1cc9f3598..70513b5659 100644 --- a/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_index_service_upsert_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_async.py index 1aad9e9471..421f2f1c30 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_sync.py index 10c3d01094..501e62a0eb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_async.py index bd527ae753..cef12a2c59 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_sync.py index 347fa3223f..fc24df327b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_async.py index 7025719f85..4dd0fcbf28 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_sync.py index 1a8cfce4ab..b1df1fa67f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_async.py index 3c5eb190f4..a933ef0316 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py index dffb8fdb17..cb7ec5bb24 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_async.py index a9409a166a..3475bc8010 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_sync.py index 17b21a6507..232adc373c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_cancel_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_async.py index c08ee1dc16..fd922a2244 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_sync.py index cfd66ff9f8..896c910942 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_async.py index bdc36dafeb..1446e3a836 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_sync.py index 7cb91b76b1..44a01d8817 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_async.py index d603667d44..75c05272d2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_sync.py index dc6578f767..5bfffbef83 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_async.py index aa7e315b8b..d1a91eb5a1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_sync.py index 4dcc86806e..5fe26bac56 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_async.py index d07dbb712d..ba6dc483b6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_sync.py index 53068ea506..552307968c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_async.py index d1b05af355..079f87a61e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_sync.py index d38de9db7b..c421c579b3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_create_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_async.py index 7a314d91a5..8f4fe9710c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_batch_prediction_job(): ) # Make the request - operation = client.delete_batch_prediction_job(request=request) + operation = await client.delete_batch_prediction_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_sync.py index 3c153937f8..7f32f554d4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_async.py index 8515b3d81a..40b6bc44d7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_custom_job(): ) # Make the request - operation = client.delete_custom_job(request=request) + operation = await client.delete_custom_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_sync.py index 76b2b24041..53684cebd8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_async.py index 9d509d0ad8..a514bb2717 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_data_labeling_job(): ) # Make the request - operation = client.delete_data_labeling_job(request=request) + operation = await client.delete_data_labeling_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_sync.py index 2122d0858d..6894755f6a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_async.py index f552f306c0..dfb7d92930 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_hyperparameter_tuning_job(): ) # Make the request - operation = client.delete_hyperparameter_tuning_job(request=request) + operation = await client.delete_hyperparameter_tuning_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_sync.py index 7aca98f5f9..94b2d63b4d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py index be390735c8..6fe3ca6293 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_deployment_monitoring_job(): ) # Make the request - operation = client.delete_model_deployment_monitoring_job(request=request) + operation = await client.delete_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_sync.py index 3464baa429..94bdef3789 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_async.py index 0558267e27..936ad5db02 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_nas_job(): ) # Make the request - operation = client.delete_nas_job(request=request) + operation = await client.delete_nas_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_sync.py index 0b11aaf9cc..419a42abfa 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_delete_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_async.py index 59af3f8d61..8ed12defdd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_sync.py index 347c56dc12..1e9003fe98 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_async.py index 46c4682bfc..9b3546aabc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_sync.py index 34b481ed43..9574a91dfb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_async.py index 3a50ce12ff..92cfbbcb0e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_sync.py index 7b0470b490..2f79f65658 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_async.py index 46d646250c..26f48e76f3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_sync.py index d41d38f3e3..e4ff25c785 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_async.py index 6809a1389f..b281a62a9f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_sync.py index 37dc0aa0e7..4f2c3eceb3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_async.py index 151bab3d44..56a4f0deaa 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_sync.py index b074e6003e..2c0f484992 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_async.py index 303cdd8639..aa08f07e46 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_sync.py index 3d642bdc29..7986507006 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_get_nas_trial_detail_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_async.py index 9472112ba2..a470d86fcf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_sync.py index 777e4ab688..09acaabbaf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_batch_prediction_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_async.py index a72fbc07c3..2fb6fd2dfc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_sync.py index 7edd272a75..6df8c00ab9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_custom_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_async.py index 9ee8fee564..75b0921ea5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_sync.py index ab2499155f..999b206082 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_data_labeling_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_async.py index 8208dd58c0..c0911aa006 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py index 1d57a22da7..c490658224 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_async.py index b9b053c0d3..0b65ea3ce5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py index 8cad9ec7b0..676da66792 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_async.py index f892dc6e5c..cd2bcc29e8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_sync.py index e843a98967..ef250dba97 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_async.py index 91902ee2b4..aa220ae822 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_sync.py index ace3c98063..9fcd3aa36e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_list_nas_trial_details_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_async.py index 8580eff6ff..e27e103ef5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_sync.py index ec6f1b3b08..35f0bbfcbd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_pause_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_async.py index a708d68638..ba4476c2dc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_sync.py index 797bb0f6bb..9a5bb642a9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_resume_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py index 6c13337246..f60b4f8810 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py index 91b9c1f42b..3430436052 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_async.py index da92ec3cf9..9bf9d87505 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_model_deployment_monitoring_job(): ) # Make the request - operation = client.update_model_deployment_monitoring_job(request=request) + operation = await client.update_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_sync.py index cea303baee..5f4afffedd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_job_service_update_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_async.py b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_async.py index 5f3e98108b..02841412a4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_sync.py b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_sync.py index 39b4e3f3e0..d39b96495f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_compute_tokens_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_async.py b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_async.py index 34af30bf7c..6395212e9f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_sync.py b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_sync.py index 44791283b0..25c4961c7b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_llm_utility_service_count_tokens_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_async.py b/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_async.py index 1fe33b1e64..c4ceef78e6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_sync.py b/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_sync.py index 05327b2e78..0b8b2b36c3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_match_service_find_neighbors_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_async.py b/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_async.py index ca82596d69..c2de458cb4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_sync.py index 6d3f616a5c..67b683dba3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_match_service_read_index_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_async.py index 9f854d7f10..cca3e9c928 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_sync.py index 39ca1648ea..d0897d217a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_artifacts_and_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_async.py index d1771a785f..3c659c2cd1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_sync.py index 154bd83b17..990a2b93b0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_context_children_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_async.py index 7e766e1474..ae7240e3f5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_sync.py index d95919cab0..cced12b0f0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_add_execution_events_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_async.py index 6c5c45e70f..70c42bede0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_sync.py index 832ae52238..e57a0d1aba 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_async.py index b6aeb9ac85..6f32ebc905 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py index c10586262a..01b0cc8da8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_async.py index 5382b2f96a..07dfbe875a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_sync.py index 0cdcd6bd58..9d4540ecbd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_async.py index d62784bcfb..059b5c156a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_sync.py index 35b43366d3..33b97b34ab 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_async.py index 4cf50aa83b..2e527719c0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_create_metadata_store(): ) # Make the request - operation = client.create_metadata_store(request=request) + operation = await client.create_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_sync.py index ac34f57673..20f5180c43 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_create_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_async.py index 3d636526ad..18049854ca 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_artifact(): ) # Make the request - operation = client.delete_artifact(request=request) + operation = await client.delete_artifact(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_sync.py index f67bbd8ee0..457cb2720f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_async.py index c57631a411..f56a641af4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_context(): ) # Make the request - operation = client.delete_context(request=request) + operation = await client.delete_context(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_sync.py index 632fb62e68..5125c8148a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_async.py index ac45a8a612..efbdf32823 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_execution(): ) # Make the request - operation = client.delete_execution(request=request) + operation = await client.delete_execution(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_sync.py index 089d69bb7d..f8bd2eb743 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_async.py index c5f3589060..167729b311 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_metadata_store(): ) # Make the request - operation = client.delete_metadata_store(request=request) + operation = await client.delete_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_sync.py index 2db18d2c9e..c3b852839d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_delete_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_async.py index 238f05344a..1a1dc2154e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_sync.py index 47b61a691c..a4aae26c95 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_async.py index 2210b7c0d4..25e2611ffe 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_sync.py index 98d77ef8d0..4fc11b8765 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_async.py index 7db4be0e27..9708b12781 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_sync.py index 6055faa99d..3cf88fd36f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_async.py index 9c587feb15..cf342add06 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_sync.py index d24b58811d..85733c1d7d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_async.py index 5d9397d1a4..b6828c5071 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_sync.py index a71f913d9a..a5ba6d2c46 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_get_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_async.py index 3b23e9df27..a7ac4b5221 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_sync.py index 6f6c66788a..40854f6329 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_artifacts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_async.py index a4dd518c7f..f7ddda73d0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_sync.py index 65c5af7aff..65657c3f64 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_async.py index 16b418a6d6..5c8d76b7f3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_sync.py index b9252d9cf2..5f8ee7bc8e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_async.py index 7b3109cdf9..7bb9dc9369 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_sync.py index ae3c6c2949..aae8a18fef 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_schemas_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_async.py index 9d6093c8b0..daf242a04f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_sync.py index 40273ba8e3..be9f8d74ea 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_list_metadata_stores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_async.py index 8449abf39d..5293f8a7d9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_artifacts(): ) # Make the request - operation = client.purge_artifacts(request=request) + operation = await client.purge_artifacts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_sync.py index 5e5f9bbb5d..8b068635b3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_artifacts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_async.py index 1ff884e321..779eb9489e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_contexts(): ) # Make the request - operation = client.purge_contexts(request=request) + operation = await client.purge_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_sync.py index 68de5b99be..0d90e25e05 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_async.py index aaa0df1304..a1bacbc965 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_executions(): ) # Make the request - operation = client.purge_executions(request=request) + operation = await client.purge_executions(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_sync.py index 8229afe040..4728fde64d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_purge_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_async.py index 06501f1aa2..f90657eccb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py index 0e14251df8..73611b7b21 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_async.py index 91cca43af8..97d929fad4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_sync.py index 2ece0536f8..4a9a44721e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_context_lineage_subgraph_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_async.py index 6b3e41c961..5de43328c8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py index 720cdc94f5..0c5f3d73cf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_async.py index 0cbf6a522c..c5ded1794a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_sync.py index 6b8a5e380b..504d6a9271 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_remove_context_children_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_async.py index 0c93f3a09d..721bcaab46 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_sync.py index 7aee55168b..a4e1e0e1e2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_async.py index e39991e4f7..032fe04fda 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_sync.py index 43738ffa8d..5b4111e3f8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_async.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_async.py index e0213bf4fc..7d04e989e0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_sync.py b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_sync.py index 8122817f2b..16df5702c6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_metadata_service_update_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_async.py b/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_async.py index da84f62270..76c9bbb681 100644 --- a/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_batch_migrate_resources(): ) # Make the request - operation = client.batch_migrate_resources(request=request) + operation = await client.batch_migrate_resources(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_sync.py b/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_sync.py index 84997b6b6c..e1a5183b59 100644 --- a/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_migration_service_batch_migrate_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_async.py b/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_async.py index 84ad856f57..6137fb8701 100644 --- a/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_sync.py b/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_sync.py index 984a46f694..007c83ef30 100644 --- a/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_migration_service_search_migratable_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_async.py b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_async.py index e68072bf99..5703ccc295 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_deploy(): ) # Make the request - operation = client.deploy(request=request) + operation = await client.deploy(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_sync.py index 19f935003c..ebf00a1c2c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_deploy_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_async.py index d0084f3ced..70cf25e9a4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_sync.py index ecccf83d5e..77892983d7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_garden_service_get_publisher_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_async.py index 8fa75eb472..2518ba581e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_sync.py index c04c11c4a8..9ee1b5338f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_evaluated_annotations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_async.py index 6330c93160..6bd28bd05d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_sync.py index bba14476f9..f3cc61d6ab 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_batch_import_model_evaluation_slices_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_async.py index de99c662cd..4824cda438 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,11 +46,11 @@ async def sample_copy_model(): ) # Make the request - operation = client.copy_model(request=request) + operation = await client.copy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_sync.py index 0ac45b3602..349222e8a0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_copy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_async.py index 4e35f4bb38..d7e99beaea 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model(): ) # Make the request - operation = client.delete_model(request=request) + operation = await client.delete_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_sync.py index 222ede21d2..9f89011d67 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_async.py index 308e50ec21..86bc22888c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_version(): ) # Make the request - operation = client.delete_model_version(request=request) + operation = await client.delete_model_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_sync.py index bf864e767a..7b63c6db0b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_delete_model_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_async.py index e96bc06711..d907993654 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_export_model(): ) # Make the request - operation = client.export_model(request=request) + operation = await client.export_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_sync.py index fb2f03674d..c1a16c80d1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_export_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_async.py index b69bb37971..2afdc6c7b1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_async.py index 0731869c64..010efaef0c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_async.py index 432e3f2415..6a3af7f924 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_sync.py index d5e0abbc37..6731f3a430 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_slice_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_sync.py index e79e044f1e..dc0e6bac84 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_evaluation_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_sync.py index bd8a29fd48..2f45e7c24f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_get_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_async.py index 307c5ee952..571e483383 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_sync.py index b1c70863fe..c2d73ac1bf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_import_model_evaluation_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_async.py index e51c24cc8b..2a0f629239 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_sync.py index bf1a30b5e8..636f83fd07 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluation_slices_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_async.py index 7748b46d75..dc46cb7e02 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_sync.py index b9cb7fba8e..39e64601c8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_evaluations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_async.py index bb6d67940a..784ff7a1e1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_sync.py index 9613f61b7e..0f3371f20d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_version_checkpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_async.py index fbb1dbf5cc..23a21433e9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_sync.py index 6859df90a5..52bffb13c3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_model_versions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_async.py index f50ca50f04..516ddb7aa6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_sync.py index 8473218c07..3a97ce77a2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_list_models_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_async.py index f977862e09..65e3422470 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_sync.py index 15ec291cb1..0894619495 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_merge_version_aliases_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_async.py index b94b4c8962..466e1b6949 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_update_explanation_dataset(): ) # Make the request - operation = client.update_explanation_dataset(request=request) + operation = await client.update_explanation_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_sync.py index 8e4c1dc478..2b7e81d076 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_update_explanation_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_async.py index f653f99c15..4a35acba9a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_sync.py index a82d8ff96e..2ace1c03f8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_update_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_async.py b/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_async.py index 62ce6a13d1..434de12a57 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_upload_model(): ) # Make the request - operation = client.upload_model(request=request) + operation = await client.upload_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_sync.py b/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_sync.py index 8af914a762..a1aba6dd0e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_model_service_upload_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_async.py index b5b60c7830..ad1d2a3f05 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_assign_notebook_runtime(): ) # Make the request - operation = client.assign_notebook_runtime(request=request) + operation = await client.assign_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_sync.py index c0b07fae04..7ba1e57537 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_assign_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_async.py index 446b955b3f..acb4b5f9e0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_notebook_execution_job(): ) # Make the request - operation = client.create_notebook_execution_job(request=request) + operation = await client.create_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_sync.py index 2fdfd805c1..7072838c06 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_async.py index b23842812d..f552c74200 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_notebook_runtime_template(): ) # Make the request - operation = client.create_notebook_runtime_template(request=request) + operation = await client.create_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_sync.py index f80e3436d6..ab7e89b0e7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_create_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_async.py index 9bdcdfa9c7..b0e46343fe 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_execution_job(): ) # Make the request - operation = client.delete_notebook_execution_job(request=request) + operation = await client.delete_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_sync.py index 0a4ece1129..d78c0fe019 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_async.py index ea14715921..e7995758d2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_runtime(): ) # Make the request - operation = client.delete_notebook_runtime(request=request) + operation = await client.delete_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_sync.py index 406ea21ef5..2d8687c185 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_async.py index fb6b9d7025..3cd9bff0a2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_runtime_template(): ) # Make the request - operation = client.delete_notebook_runtime_template(request=request) + operation = await client.delete_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_sync.py index a8819ec0d4..5fb9b949d5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_delete_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_async.py index acc7a8bc06..2993a6229a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_sync.py index fc99ac8dff..8637a86e92 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_async.py index b362d1fea5..c1f5942718 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_sync.py index dc422e974b..a7368482ef 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_async.py index 7c825235bc..daadd894b5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_sync.py index d43469c5d7..52ed9c49b9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_get_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_async.py index bc90d2837e..0541e20473 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_sync.py index 81cf1a1315..40fc39181f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_execution_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_async.py index f74281f4d3..fcdbcdd771 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_sync.py index 92ea1addd5..bee7bfdd7e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtime_templates_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_async.py index 84a489efb4..0ba20581da 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_sync.py index 29b1e46531..d8b0788a12 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_list_notebook_runtimes_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_async.py index d47c50eb66..0096717e79 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_start_notebook_runtime(): ) # Make the request - operation = client.start_notebook_runtime(request=request) + operation = await client.start_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_sync.py index 4aa6931dc5..d428c5db5d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_start_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_async.py index c3124a880b..292517af1a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_stop_notebook_runtime(): ) # Make the request - operation = client.stop_notebook_runtime(request=request) + operation = await client.stop_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_sync.py index 6600f4b64f..e32a21738d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_stop_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_async.py index 0ad98350c2..2474fb21d6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_sync.py index ddbcfc8a0d..396174d65d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_update_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_async.py index fea0a56fcd..6a374481c9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_upgrade_notebook_runtime(): ) # Make the request - operation = client.upgrade_notebook_runtime(request=request) + operation = await client.upgrade_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_sync.py index a5b2201dd3..0cefa0fb0e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_notebook_service_upgrade_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_async.py index 741f1b240b..e03bf63ae2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_persistent_resource(): ) # Make the request - operation = client.create_persistent_resource(request=request) + operation = await client.create_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_sync.py index 59e3f60c7a..5d071636a1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_create_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_async.py index 6b4335f7b9..73b2dec145 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_persistent_resource(): ) # Make the request - operation = client.delete_persistent_resource(request=request) + operation = await client.delete_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_sync.py index ff1282f04d..6f4063803c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_delete_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_async.py index e3b1a43c23..5b47333727 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_sync.py index 3b5625a5c1..427c2499d1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_get_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_async.py index 2b285134b6..6c1c2eef98 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_sync.py index a1f9b2344f..a6446be783 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_list_persistent_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_async.py index 758920e524..b335b44b7c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_reboot_persistent_resource(): ) # Make the request - operation = client.reboot_persistent_resource(request=request) + operation = await client.reboot_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_sync.py index 48d661ce6e..8c97e1677f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_reboot_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_async.py index a74366ab33..116aa3c209 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_persistent_resource(): ) # Make the request - operation = client.update_persistent_resource(request=request) + operation = await client.update_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_sync.py index 9e034acdd1..c53e470c70 100644 --- a/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_persistent_resource_service_update_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py index 7d6bfa5988..9dfc19468e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_cancel_pipeline_jobs(): ) # Make the request - operation = client.batch_cancel_pipeline_jobs(request=request) + operation = await client.batch_cancel_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py index 64660de232..8cecf74945 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py index 8a6dd09cda..64f6f87466 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_delete_pipeline_jobs(): ) # Make the request - operation = client.batch_delete_pipeline_jobs(request=request) + operation = await client.batch_delete_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py index 5024de0877..88f3fa5040 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_async.py index 719ece273c..be39a3e499 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_sync.py index 3b81db04c7..1a764684ac 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_async.py index eae12f5e42..3686b5fdac 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_sync.py index bf50d90159..8f70128ce6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_cancel_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_async.py index 4c07868f39..c5c3ba1121 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_sync.py index 76e6313bd1..734726185f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_async.py index e926f9e8b6..043ad7e82d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_sync.py index 0acf00cbfc..af419a3985 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_create_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_async.py index 4057021ba2..9a104f8a6e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_pipeline_job(): ) # Make the request - operation = client.delete_pipeline_job(request=request) + operation = await client.delete_pipeline_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_sync.py index c80d946a32..5e02075552 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_async.py index 22a35d16f5..7ac4630f72 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_training_pipeline(): ) # Make the request - operation = client.delete_training_pipeline(request=request) + operation = await client.delete_training_pipeline(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_sync.py index b8ef4b2d10..983796822a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_async.py index 62f3fd6ee4..b4a4106b50 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_sync.py index fb24e16b7b..344995d142 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_async.py index 17b2c369b1..ca67a2d49f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_sync.py index 84bf8c1131..dd231488c9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_get_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_async.py index a023acbe54..36ac75120e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_sync.py index 2316c60c34..28b9ef2261 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_async.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_async.py index db783e231b..f0b9e9fe16 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_sync.py b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_sync.py index 51f1f9e304..7f5b5110a0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_pipeline_service_list_training_pipelines_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_async.py index f6cfbd48ac..fcfdd0d384 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_sync.py index 7aea23a2f2..eb0968d613 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_async.py index 4e0ddc1959..719136b3a8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_sync.py index 5e42d7ada1..a7f41822e6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_direct_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_async.py index 919c1243b1..be9fe38753 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_sync.py index 174c624141..71e54e0ff3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_embed_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_async.py index 86518eb503..1cad29ed08 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_sync.py index 9bc0a05418..b3174f00ab 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_explain_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_async.py index fb1c620a77..d732e0de1f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_sync.py index b8836d6622..46f76ef76a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_generate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_async.py index 777ea85df0..1ec881c44a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_sync.py index 4b82033a60..13e660a48b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_async.py index 7a5035d911..d5f50d9fdc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_sync.py index 6ccbdd6b82..0072aabc4e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_async.py index 5f6826e5e6..77a38f3660 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_sync.py index 86a58e98b7..7ca4207520 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_server_streaming_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_async.py index 38ebd0e631..8225498362 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_sync.py index 8e19423ae7..8ebffc1340 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_async.py index 1da4964f4f..92b2013697 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_sync.py index f43b1ff5d9..4aff53e02e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_direct_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_async.py index 574e5604cb..116c77a2bb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_sync.py index dd4dc93c86..b2e38193ed 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_generate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_async.py index c65e92eb2a..b5006f96ba 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_sync.py index 6f0ae691a5..1aaa9040a2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_stream_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_async.py index 380c6f8c69..70ed871810 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_sync.py index 3279f59235..399049a3af 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_async.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_async.py index 441780db36..ef7a5f5c13 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_sync.py index 7b0561abf6..aaed1c7893 100644 --- a/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_prediction_service_streaming_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py index 0d2bc628a5..18c73e2ef2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_async_query_reasoning_engine(): ) # Make the request - operation = client.async_query_reasoning_engine(request=request) + operation = await client.async_query_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py index 577b75f47f..06edcbae49 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py new file mode 100644 index 0000000000..347632837d --- /dev/null +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelAsyncQueryReasoningEngine +# 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-aiplatform + + +# [START aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_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 aiplatform_v1 + + +async def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = await client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_async] diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py new file mode 100644 index 0000000000..852554021b --- /dev/null +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelAsyncQueryReasoningEngine +# 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-aiplatform + + +# [START aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_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 aiplatform_v1 + + +def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1.ReasoningEngineExecutionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync] diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py index 0e9581ff6d..07b34f9442 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py index 180529ad71..bb73134bbf 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py index eedc3b5bb4..85cb49c106 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py index 96184016c8..5b969139a8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_async.py index 74954793c0..bc9a102393 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_reasoning_engine(): ) # Make the request - operation = client.create_reasoning_engine(request=request) + operation = await client.create_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_sync.py index 4056701ece..ce60a5b095 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_create_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_async.py index 0afee97320..e3e8e8c1fe 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_reasoning_engine(): ) # Make the request - operation = client.delete_reasoning_engine(request=request) + operation = await client.delete_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py index 82cc556f3e..3cdefb92a0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_async.py index f20066ab3b..bd8aae76cd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_sync.py index 926ccdea5d..82e29982fc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_get_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_async.py index 718aa27248..aa8faedcd2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_sync.py index 7e63ac7142..e55bbba5b8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_list_reasoning_engines_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_async.py index c4296acec2..e1ea4ee125 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_reasoning_engine(): ) # Make the request - operation = client.update_reasoning_engine(request=request) + operation = await client.update_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_sync.py index 0cd8ec4d82..cacea6ec4a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_reasoning_engine_service_update_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_async.py index f8caa40e50..196edb8480 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_sync.py index 9cb643bd53..4b6240eb3c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_create_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_async.py index 625b248ded..fa8d0e8583 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_schedule(): ) # Make the request - operation = client.delete_schedule(request=request) + operation = await client.delete_schedule(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_sync.py index e87fc7c071..85d3d0feee 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_delete_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_async.py index 2521e664c8..0263270d77 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_sync.py index 784dede386..a0c97870f0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_get_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_async.py index 37125cca89..06df4399b1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_sync.py index 51bcaf3ce5..a0da4615b7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_list_schedules_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_async.py index 43b775e59e..8fd053ee7a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_sync.py index 1840f55568..b67f4a360a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_pause_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_async.py index 94942c219d..dbc3847ff2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_sync.py index 0363c1ec3d..ce86db0efc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_resume_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_async.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_async.py index 53e0a8f71f..cee372b7d2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_sync.py b/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_sync.py index 3a2bae0a22..30cd5d7ea7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_schedule_service_update_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_async.py index 18227163c3..a9be9f3a24 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_sync.py index 706051b7af..1c83a8904b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_append_event_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_async.py index 359a9efc16..c65bc77bcb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_session(): ) # Make the request - operation = client.create_session(request=request) + operation = await client.create_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_sync.py index c9d209bcad..c620d1a902 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_create_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_async.py index f37934aa10..18f55725ef 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_session(): ) # Make the request - operation = client.delete_session(request=request) + operation = await client.delete_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_sync.py index 8bc3e3a72f..09226fd525 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_delete_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_async.py index 7148b3cc8b..2bd3fcfbb8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_sync.py index f7d310c761..2b05272f7e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_get_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_async.py index 61caaa2141..4ee82a4622 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_sync.py index ad94f6a1d7..8f361bb981 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_list_events_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_async.py index 819dd09ad7..54412a1b7e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_sync.py index db19cc416f..bde469c74c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_list_sessions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_async.py b/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_async.py index 1b4adb6c42..90c4570721 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_sync.py b/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_sync.py index 5d7c236640..17a5d80c5f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_session_service_update_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_async.py index 669ea44beb..7003b99c24 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_specialist_pool(): ) # Make the request - operation = client.create_specialist_pool(request=request) + operation = await client.create_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_sync.py index 303f0d03d5..4029ce1243 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_async.py index bde45520f4..0d339658de 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_specialist_pool(): ) # Make the request - operation = client.delete_specialist_pool(request=request) + operation = await client.delete_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_sync.py index aadaffd1ec..4b516e416c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_delete_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_async.py index f766abe3a9..a2a818a4e2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_sync.py index 3e8e514a00..18ea551fdb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_get_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_async.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_async.py index 4226f86a6b..6c121e99f9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_sync.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_sync.py index e82d2ff085..1ef905e5f5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_list_specialist_pools_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_async.py index 7ef479eb92..77b77d4f16 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_specialist_pool(): ) # Make the request - operation = client.update_specialist_pool(request=request) + operation = await client.update_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_sync.py index 0188d9abb4..dfa02b3044 100644 --- a/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_update_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py index 6db9a87f30..fc3d5e76a6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py index cb706fcaa9..46039a5ee4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py index 40e04575ea..1332930a2e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py index 9d99c32a13..3d89456ab4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py index 2e8cc3fdf8..b6781fa667 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py index 1bf1e5c1e9..22015f5866 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_async.py index e30d977816..09a10f35b3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_tensorboard(): ) # Make the request - operation = client.create_tensorboard(request=request) + operation = await client.create_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_async.py index 0f0ceeec4c..ddb9d8cef4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_sync.py index 15062e46a0..16b0767c4c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_async.py index e40f11eff9..7c63ee4957 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_sync.py index e566ea3357..1af06fef13 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_sync.py index 2bd5f0fe3e..7bb0c0be67 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_async.py index 000f8fd32d..662f9fcd9e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_sync.py index 3f7e481b35..8843ab411a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_create_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_async.py index 792f114c44..2cc818418a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard(): ) # Make the request - operation = client.delete_tensorboard(request=request) + operation = await client.delete_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_async.py index 8c0326e2b7..3e17f70bb0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_experiment(): ) # Make the request - operation = client.delete_tensorboard_experiment(request=request) + operation = await client.delete_tensorboard_experiment(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py index c9f61757d7..5b11ebbfd8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_async.py index 7196b69256..e8ada1f8c1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_run(): ) # Make the request - operation = client.delete_tensorboard_run(request=request) + operation = await client.delete_tensorboard_run(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_sync.py index b6cf59570c..e4b40f44ef 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_sync.py index 38d64e1dc3..e94c6a4dd6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_async.py index e2c84d0fa2..110ccc7af1 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_time_series(): ) # Make the request - operation = client.delete_tensorboard_time_series(request=request) + operation = await client.delete_tensorboard_time_series(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py index 8b1845b475..5e759ad648 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py index a8ab4d7333..08dcabfe3c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py index a8279e41b3..6e6cf159a8 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_async.py index 8d029ec3e6..d9bf7f419f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_async.py index e381c9b738..cd1428c1b5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_sync.py index 63b08297ad..9a2f56d431 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_async.py index 10fe2c7be7..e2e4e85785 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_sync.py index 17972a4e37..9310dd4a9e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_sync.py index 2126526653..11a823275b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_async.py index 104cb80e23..86b69ee54c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_sync.py index 9b66d3806a..d90546559b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_get_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_async.py index 61fcd7bc84..868b0ead76 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_sync.py index a9ac9e9d90..baa3a06534 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_experiments_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_async.py index 49cb89a2f9..a23bfd4913 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_sync.py index 04b89e23c0..efff71cc1a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_runs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_async.py index b956c58f42..f99dc6590b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_sync.py index 08d9bfec11..7ffc698dd6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_async.py index 4f334cbafa..a12993b4ac 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_sync.py index 7f3582910b..5d6fd7999c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_list_tensorboards_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_async.py index d9d6b3c3a1..5f8359cb6b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py index bcfe9a3fe1..ba30d35a00 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_async.py index e7a884d674..8d77f073bc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_sync.py index 05cd014e97..b6b50e148f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_size_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py index 4aac4e66ff..bab7246db9 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py index b1c7a24fa4..1039290bad 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_async.py index 66bb552e1b..3e1f4c57ed 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_sync.py index 16d7c1b16d..ce5c004c56 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_usage_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_async.py index 207e0c6bad..73d0ccff90 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_tensorboard(): ) # Make the request - operation = client.update_tensorboard(request=request) + operation = await client.update_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_async.py index 1e5a77893e..29c62ab9fc 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_sync.py index c6becaa677..a88823c90d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_async.py index 25ffeaa1c1..8d86add78d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_sync.py index d68503155e..f4f134bc9b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_sync.py index a4f15314c2..8aa0ca68d7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_async.py index 52c084f376..d8d45abfb4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_sync.py index f1eac887e5..0896d27a4b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_update_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py index 6f52512a73..5b33aa28be 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py index d155c5cb5a..a9f4d78e26 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_async.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_async.py index 00b4790093..8dfb49e2ff 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_sync.py b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_sync.py index 4337e77812..374288091a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_tensorboard_service_write_tensorboard_run_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_async.py index a49e0d3da9..6208202ee2 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_rag_corpus(): ) # Make the request - operation = client.create_rag_corpus(request=request) + operation = await client.create_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_sync.py index bcf9b4259b..47d57aeee4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_create_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_async.py index 60c2b8f98c..4f71b996d5 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_rag_corpus(): ) # Make the request - operation = client.delete_rag_corpus(request=request) + operation = await client.delete_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py index 8c9ac97cf0..54694927f3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_async.py index 7e82ca3963..fdae59ffc7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_rag_file(): ) # Make the request - operation = client.delete_rag_file(request=request) + operation = await client.delete_rag_file(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_sync.py index ce2f841bce..c3d94ac6a6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_delete_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_async.py index 8801b50ca1..5ec21b23ea 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_sync.py index 1d7e869117..fa5bbae2d3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_async.py index 74ec21c802..96608b33b6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py index 3560db6861..43e5d8a1c0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_async.py index 340711a136..de808d6158 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_sync.py index 4cb17e37ac..ed9fae5575 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_get_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_async.py index fd6fd77452..4ba00a7574 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_import_rag_files(): ) # Make the request - operation = client.import_rag_files(request=request) + operation = await client.import_rag_files(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_sync.py index dc21b3a97e..1d6a31755f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_import_rag_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_async.py index 2e89381d9f..755f19dc8a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_sync.py index 93068bed8d..63aabf9f9a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_corpora_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_async.py index d63f3bec7b..4dca782a8f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_sync.py index 7ace43ccd8..f51fb95b6e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_list_rag_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_async.py index 6146dac9e4..0bd6c068f0 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_rag_corpus(): ) # Make the request - operation = client.update_rag_corpus(request=request) + operation = await client.update_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_sync.py index e45c893a38..19ff165445 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_async.py index bdecd52509..50c9b643bd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_rag_engine_config(): ) # Make the request - operation = client.update_rag_engine_config(request=request) + operation = await client.update_rag_engine_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py index 3a1d8671dc..4f82457d46 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_async.py index 70d4293d37..1910852806 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_sync.py index a882a99bdb..0e1c335c21 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_data_service_upload_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_async.py index bc2f0f8729..c30d24aa52 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_sync.py index 5401dfec5d..77922636d3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_ask_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_async.py index 6e9cbc963d..8ff9a92780 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_async_retrieve_contexts(): ) # Make the request - operation = client.async_retrieve_contexts(request=request) + operation = await client.async_retrieve_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_sync.py index 5f3f335f2a..2544e151fe 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_async_retrieve_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_async.py index b311c9a071..bbf9cb0430 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_sync.py index 82c69a8535..cf902bdb9e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_augment_prompt_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_async.py index a7779979d9..c6507b8853 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_sync.py index 76dcf94c8f..0fd90c881f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_corroborate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_async.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_async.py index 61e3f37bd2..de32bc42bb 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_sync.py b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_sync.py index e42cd116a8..5d910f226e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vertex_rag_service_retrieve_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_async.py index 2f50c89923..a6fa4732d6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_sync.py index 406ee82316..a2d2af732e 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_add_trial_measurement_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_async.py index b71dfe011a..033642bd4a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_check_trial_early_stopping_state(): ) # Make the request - operation = client.check_trial_early_stopping_state(request=request) + operation = await client.check_trial_early_stopping_state(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_sync.py index 78ca2f23e5..4dd049c082 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_check_trial_early_stopping_state_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_async.py index 7331e2eccd..9d1d1b353c 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_sync.py index 8a98e9c1e6..a5d7f9c4cd 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_complete_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_async.py index 5464ef0211..cc4ec6857d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_sync.py index 9584163daa..4bcc267ed7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_async.py index c2f016eb85..6e8a95fe66 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_sync.py index d59e22c15f..4ac503b90a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_create_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_async.py index d1e457bcee..dcd42a1f61 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_sync.py index 7f20f0a9f6..841139ea7f 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_async.py index 582ff5a662..873ed7852a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_sync.py index 31f51a944b..9c11724de6 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_async.py index 4ef9e760ff..f380348140 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_sync.py index 1f5497336b..7e012fed4d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_async.py index 66eb411d91..7ebb279e90 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_sync.py index 50291e6992..6eeb5089d7 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_get_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_async.py index cb9aa51469..8cdd13837b 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_sync.py index 62cb643588..529c67fc66 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_optimal_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_async.py index 1372fef479..02fa17ed0d 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_sync.py index 95147354aa..2520bcd6f3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_studies_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_async.py index 9f0c46a8de..ccb07c82f3 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_sync.py index 6d197d4cc7..0612526bd4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_list_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_async.py index f40c01d0ee..2b6ccf657a 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_sync.py index a85800fe58..5be4b3e5a4 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_lookup_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_async.py index 0c52051ac9..19be62a539 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_sync.py index 0dcdb20974..2f3f49c960 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_stop_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_async.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_async.py index faa7674389..a14ee71e10 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_async.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,11 +46,11 @@ async def sample_suggest_trials(): ) # Make the request - operation = client.suggest_trials(request=request) + operation = await client.suggest_trials(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_sync.py b/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_sync.py index feab7458bd..70dab422ec 100644 --- a/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1_generated_vizier_service_suggest_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_async.py index a8c342bdf9..433a2696d0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_assemble_data(): ) # Make the request - operation = client.assemble_data(request=request) + operation = await client.assemble_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_sync.py index dd0d0d23b7..ae9424a344 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assemble_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_async.py index 854b1e6ef7..6fc7b5f2b4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_assess_data(): ) # Make the request - operation = client.assess_data(request=request) + operation = await client.assess_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_sync.py index 2c27cc7d6f..320f7fb0bd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_assess_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_async.py index 168852cbf1..4733c234d7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_dataset(): ) # Make the request - operation = client.create_dataset(request=request) + operation = await client.create_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_sync.py index ab37f53474..cc222c945d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_async.py index b277ced970..a6d53633d2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_dataset_version(): ) # Make the request - operation = client.create_dataset_version(request=request) + operation = await client.create_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_sync.py index bd9cb7b920..8c1b51efb3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_create_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_async.py index b189f72486..2e5319c3b0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_dataset(): ) # Make the request - operation = client.delete_dataset(request=request) + operation = await client.delete_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_sync.py index 49759453f3..42388148c9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_async.py index 4a8bc7e004..f47ade5135 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_dataset_version(): ) # Make the request - operation = client.delete_dataset_version(request=request) + operation = await client.delete_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_sync.py index 3f2ffc20de..33e970905f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_async.py index 92ca753a95..b5d7bf999d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_saved_query(): ) # Make the request - operation = client.delete_saved_query(request=request) + operation = await client.delete_saved_query(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_sync.py index 8f2f2308ec..acc843a737 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_delete_saved_query_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_async.py index 1e2266e8c6..143b2aaee7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_export_data(): ) # Make the request - operation = client.export_data(request=request) + operation = await client.export_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_sync.py index 2381378070..9c659d326c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_export_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_async.py index 799f85422b..db5e5f1a52 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_sync.py index c3cea4ed49..91d3186da9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_annotation_spec_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_async.py index 28919afa29..57f3108287 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_sync.py index dcb4270e5c..d3fbcbb347 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_async.py index 5fb592d5b8..7d287ec4a9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_sync.py index 5ad1b4ba9c..f26601f338 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_get_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_async.py index db4c9c4202..aee1e57b24 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_import_data(): ) # Make the request - operation = client.import_data(request=request) + operation = await client.import_data(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_sync.py index d1edeb1021..19c3862dba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_import_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_async.py index 2ec08a2e95..dbcdd9003e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_sync.py index ff4e132645..b448dc62ca 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_annotations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_async.py index 3291fd30b3..ed30a1f885 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_sync.py index d9373cb7a5..51fce01a92 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_data_items_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_async.py index e7ad252c18..5aed21dd28 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_sync.py index e04f1c2b30..ed6e10f910 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_dataset_versions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_async.py index ae4957dbde..d1caf0314e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_sync.py index 024416dbfb..42666c23c2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_datasets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_async.py index 74559f97a3..94ed06a915 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_sync.py index ecb0f28b6e..56020e8e5f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_list_saved_queries_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_async.py index 8651e0086f..7ea3714fdd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_restore_dataset_version(): ) # Make the request - operation = client.restore_dataset_version(request=request) + operation = await client.restore_dataset_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_sync.py index 2345993d34..968d0689d1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_restore_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_async.py index dad2314eb4..d5b61e5524 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_sync.py index 2d2e18ee39..9f414abd75 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_search_data_items_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_async.py index 563c75bc96..a9ee2e7051 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_sync.py index 8907163a28..61d940bcce 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_async.py index a5f8df47e2..f5127cb560 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_sync.py index 83ff0d0c01..d009d1932e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_dataset_service_update_dataset_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py index 54441afbd0..da6431c1c9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_deployment_resource_pool(): ) # Make the request - operation = client.create_deployment_resource_pool(request=request) + operation = await client.create_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py index 304941f7b4..e90f1cdb5e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_create_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py index e47b23cb58..c247e3d875 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_deployment_resource_pool(): ) # Make the request - operation = client.delete_deployment_resource_pool(request=request) + operation = await client.delete_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py index cc255549c9..4bee9ef464 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_delete_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py index a0ebad67dd..c308e8846e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py index 14263e2401..b87fb74566 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_get_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py index 3c3c653a8a..1833f7302b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py index f6c745961b..3570faf57b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_list_deployment_resource_pools_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_async.py index cc7d4f823d..2d1813b793 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_sync.py index 4e7230fc46..21abffe345 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_query_deployed_models_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py index 97bdca1471..00c25ab49e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_deployment_resource_pool(): ) # Make the request - operation = client.update_deployment_resource_pool(request=request) + operation = await client.update_deployment_resource_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py index 7d37634fed..861fd54cf9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_deployment_resource_pool_service_update_deployment_resource_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_async.py index 7018cc1352..da005d9643 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_endpoint(): ) # Make the request - operation = client.create_endpoint(request=request) + operation = await client.create_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_sync.py index 2b3d9cd77a..773f2ba8ff 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_create_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_async.py index 8a2634ee77..cd4a0dbc03 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_endpoint(): ) # Make the request - operation = client.delete_endpoint(request=request) + operation = await client.delete_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_sync.py index 91e332c937..f6210e8906 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_delete_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_async.py index 8332d880cc..bd584e17cd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_deploy_model(): ) # Make the request - operation = client.deploy_model(request=request) + operation = await client.deploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_sync.py index a9e2603438..59e0f1d322 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_async.py index cbce1d1086..2019581c73 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_sync.py index 56e2fd22e0..26a914e5c9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_fetch_publisher_model_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_async.py index a12ca6925b..71ec2d4fe4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_sync.py index 9743a87c4b..91e80e6b3f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_get_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_async.py index 682928a9ae..90265c873a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_sync.py index 562bbd5d5f..c717ba3dfc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_list_endpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_async.py index 25023cd6c2..0b18afff36 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_mutate_deployed_model(): ) # Make the request - operation = client.mutate_deployed_model(request=request) + operation = await client.mutate_deployed_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_sync.py index 8460b1d068..4f55bf2ee5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_mutate_deployed_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_async.py index 526c1088a5..bdeb273c52 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_set_publisher_model_config(): ) # Make the request - operation = client.set_publisher_model_config(request=request) + operation = await client.set_publisher_model_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_sync.py index e04826aeaf..e2c3e27dd7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_set_publisher_model_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_async.py index 6a6f326df0..0802c79fb4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_undeploy_model(): ) # Make the request - operation = client.undeploy_model(request=request) + operation = await client.undeploy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_sync.py index 3e0fe10581..3689b8f47f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_undeploy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_async.py index 5751420eb9..0d440df560 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_async.py index b1dc215dfd..b1b403a0e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_endpoint_long_running(): ) # Make the request - operation = client.update_endpoint_long_running(request=request) + operation = await client.update_endpoint_long_running(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_sync.py index 04b7e0ec6a..b7d711baf1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_long_running_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_sync.py index 11dcf933e9..81be5ed7ca 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_update_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_async.py index 16c0cd8ebf..ef5ad50618 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,11 +56,11 @@ async def sample_evaluate_dataset(): ) # Make the request - operation = client.evaluate_dataset(request=request) + operation = await client.evaluate_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_sync.py index 202e61b5f1..d804d134f4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_async.py index 0f993d94f0..0dddc2ea2c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_sync.py index d8850e1456..241f114969 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_evaluate_instances_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_async.py index b853fa1c6c..23bf6f27ba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_sync.py index 29f4b3933d..ef8cc15e6f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_evaluation_service_generate_instance_rubrics_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_async.py index fe06ca4e54..f045f092cd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_example_store(): ) # Make the request - operation = client.create_example_store(request=request) + operation = await client.create_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_sync.py index ef75050de2..349c140383 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_create_example_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_async.py index 8ecec994e1..e4982120da 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_example_store(): ) # Make the request - operation = client.delete_example_store(request=request) + operation = await client.delete_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_sync.py index 9f20aea5da..b41fec9478 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_delete_example_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_async.py index 6da3d59e04..b2d524cfba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_sync.py index 6dff6241b5..69d150f31a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_fetch_examples_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_async.py index 5250816aad..2dfad94a98 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_sync.py index ca9810720d..cb0280785a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_get_example_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_async.py index e3e3f7987d..6f74576ae8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_sync.py index 5be6fb0edd..cba268a76f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_list_example_stores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_async.py index 77e10a0425..8f40304289 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_sync.py index ac0aaa2985..786f5ef06f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_remove_examples_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_async.py index 60f3d25f6a..bb745eb87c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_sync.py index 20913482a0..847ff3aeb1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_search_examples_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_async.py index 2f9272d9cb..8341d85305 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_example_store(): ) # Make the request - operation = client.update_example_store(request=request) + operation = await client.update_example_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_sync.py index 96b034d068..6028e8e530 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_update_example_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_async.py index 68da3376a2..fdbf05dc7d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_sync.py index 78f9bde2c8..3942045c93 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_example_store_service_upsert_examples_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_async.py index d6cce4a874..c4001dcf20 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_sync.py index fc58d3a8da..d2ac08bb73 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_execute_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_async.py index 63509be37f..a2ee2c0971 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_sync.py index d43a53ff5d..ccd8d0fe32 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_execution_service_query_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_async.py index 3b6b6474fc..5ee7c926db 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_extension(): ) # Make the request - operation = client.delete_extension(request=request) + operation = await client.delete_extension(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_sync.py index ccbf358416..6de1d93145 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_delete_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_async.py index 8d8b8434c0..885e1ff0a8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_sync.py index f8c53b2fda..50c24d3e0b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_get_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_async.py index 597d84027a..fc1169cd5f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,11 +54,11 @@ async def sample_import_extension(): ) # Make the request - operation = client.import_extension(request=request) + operation = await client.import_extension(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_sync.py index f5876ca051..93c5c52e7d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_import_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_async.py index 42d38b9ea7..89846ea4cb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_sync.py index 3de3183137..1f7d4bb58d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_list_extensions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_async.py index bc7662b82f..aa6c1bf4df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_sync.py index a79e94c2a9..530d4a9f0d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_extension_registry_service_update_extension_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_async.py index 1513285979..c323736aa7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_feature_online_store(): ) # Make the request - operation = client.create_feature_online_store(request=request) + operation = await client.create_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py index 80f988eb9b..e8d097a93f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_async.py index e02cf64560..7751005f5a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_feature_view(): ) # Make the request - operation = client.create_feature_view(request=request) + operation = await client.create_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_sync.py index 2e067cef93..82026ba502 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_create_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py index d33ce6f519..6951b6f4e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_online_store(): ) # Make the request - operation = client.delete_feature_online_store(request=request) + operation = await client.delete_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py index b942fcb97d..a75dbec689 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_async.py index 99ae5b37c2..1c6a1aa53e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_view(): ) # Make the request - operation = client.delete_feature_view(request=request) + operation = await client.delete_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_sync.py index b8b3b194f0..2daee3fb78 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_delete_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_async.py index 240d8eff8b..9ca78f84af 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py index 12fd0f696d..6e2ffa5719 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_async.py index 1629d5f59f..60a13cb2e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync.py index acf2d6a99d..b3c4ad55cd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py index 76b9ce28a8..f8ed11ef25 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py index 7b1b33894a..f8a8beaf94 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_get_feature_view_sync_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py index 238a340b8f..9f258546b6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py index af2c7d98e4..b8e1a368ca 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_online_stores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py index fc629ea56a..c1c6822501 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py index 428eecfe52..387fcf1b5b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_view_syncs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_async.py index 5baae59f85..5f053417c5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_sync.py index 6894f2c082..364538e3ea 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_list_feature_views_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_async.py index a246a2de41..949ac38f32 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_sync.py index c1a1dc6851..ea429e4451 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_sync_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_async.py index 1ef40ee2a9..61f2bce75a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_feature_online_store(): ) # Make the request - operation = client.update_feature_online_store(request=request) + operation = await client.update_feature_online_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py index 5ae1873c4f..026e320d08 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_online_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_async.py index 43c85d7644..c19b6c2df1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_feature_view(): ) # Make the request - operation = client.update_feature_view(request=request) + operation = await client.update_feature_view(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_sync.py index e21d3ce030..e559f775fe 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_admin_service_update_feature_view_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_async.py index bbbabfaa9e..1f1b76a804 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_sync.py index b6feecd854..59eae30109 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_feature_view_direct_write_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_async.py index ba8d02de5b..c4aa7b59f8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_sync.py index d661dc512b..4df93c4e47 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_fetch_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_async.py index 88a54c63f6..7817243c26 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_sync.py index fc7faceab5..9597eb0f38 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_generate_fetch_access_token_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_async.py index b38f11b5c9..2926938217 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_sync.py index 36394a30c9..a49a9cb38c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_search_nearest_entities_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_async.py index 5a2ec3dd28..9acb687cc6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_sync.py index e79d2b0239..279fe84f6a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_online_store_service_streaming_fetch_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_async.py index cc70aefe3d..414e5b73b8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_sync.py index 29da518330..1d324c0de5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_batch_create_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_async.py index 8b63628b5f..42d8845098 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_async.py index f6406c09a4..50172fb22e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_feature_group(): ) # Make the request - operation = client.create_feature_group(request=request) + operation = await client.create_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_sync.py index 8bb18aeb96..acf155fc77 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_async.py index 9c3d2942a1..b994d7b01a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_feature_monitor(): ) # Make the request - operation = client.create_feature_monitor(request=request) + operation = await client.create_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_async.py index 07a8b9afd6..1a3b30d2de 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_sync.py index 7d2e7eb21a..f1a4da48fb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_sync.py index 372d135949..a151ce5a84 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_sync.py index 395520cc05..9bbc073688 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_create_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_async.py index fd7819b3a0..4947f769f6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_async.py index d51501bb0c..314dba90c0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_group(): ) # Make the request - operation = client.delete_feature_group(request=request) + operation = await client.delete_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_sync.py index a90a408f7f..25a01452c2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_async.py index 5885f7311c..ea9c51acd7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature_monitor(): ) # Make the request - operation = client.delete_feature_monitor(request=request) + operation = await client.delete_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_sync.py index e93796d837..00cd2571c2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_sync.py index 8fdebe5351..4a9c5dd857 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_delete_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_async.py index d9670ff5e7..ee2936a32a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_async.py index 25aa36e4fa..79fdfa805b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_sync.py index 79675c9401..e48954e582 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_async.py index 5a5f1fea48..7ad1533b2a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_async.py index ca5321f8f9..31aae53be8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_sync.py index 741564a08a..38cafa8103 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_sync.py index fca455468a..d22716368a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_sync.py index 58210ae2ec..6b164aaff3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_get_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_async.py index c7a4c9093b..8b1d05f6fc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_sync.py index 47a9940f3a..2bde370bc6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_groups_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_async.py index 1656c12d4d..da2bb6c561 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_sync.py index 790d5f9819..641bcf7700 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitor_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_async.py index 93e093ddb6..bbc108c7f0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_sync.py index 6ae351ab01..d1464b5ec6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_feature_monitors_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_async.py index f0dbf485b0..7f70bf8407 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_sync.py index 7dfcf1304e..98f5904c50 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_list_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_async.py index 2add362f6d..ff0a7775c3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_feature(): ) # Make the request - operation = client.update_feature(request=request) + operation = await client.update_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_async.py index f0a695c298..4183628f44 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_feature_group(): ) # Make the request - operation = client.update_feature_group(request=request) + operation = await client.update_feature_group(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_sync.py index c24cd284c2..aeda210e4f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_group_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_async.py index 563745ac04..69e40ea8f8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_feature_monitor(): ) # Make the request - operation = client.update_feature_monitor(request=request) + operation = await client.update_feature_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_sync.py index ad0a6f575b..cd485693bd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_sync.py index d3ba891c86..cd685b8b53 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_feature_registry_service_update_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_async.py index 9cc2cd2ee8..99bfaffb63 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_sync.py index b185b1fa53..ae960a6f96 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py index 7325dc0a0c..a274a35caf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py index e0cbed1735..d030afb06a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_streaming_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_async.py index 8226ef4b32..8cb0e163b3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_sync.py index b40c4e56c9..0da336990d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_online_serving_service_write_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_async.py index 0f1fb16ae2..1853c5e5fc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_batch_create_features(): ) # Make the request - operation = client.batch_create_features(request=request) + operation = await client.batch_create_features(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_sync.py index dc303365ca..cc54c5ed81 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_create_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_async.py index 5ea7f2cb0c..a4ed283203 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,11 +57,11 @@ async def sample_batch_read_feature_values(): ) # Make the request - operation = client.batch_read_feature_values(request=request) + operation = await client.batch_read_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_sync.py index e15482fade..6ce3903fa2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_batch_read_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_async.py index ce362a3ef6..7d84933f92 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_entity_type(): ) # Make the request - operation = client.create_entity_type(request=request) + operation = await client.create_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_sync.py index 19447d9103..7d52d06a54 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_async.py index 2c9a916a72..c5145d6b0a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_feature(): ) # Make the request - operation = client.create_feature(request=request) + operation = await client.create_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_sync.py index 81e46a5790..ff0d5ab8f8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_async.py index a826130cea..ab30f176e6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_featurestore(): ) # Make the request - operation = client.create_featurestore(request=request) + operation = await client.create_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_sync.py index 1653c8778b..abb8c07b17 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_create_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_async.py index 4afc6bc610..50ab92738c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_entity_type(): ) # Make the request - operation = client.delete_entity_type(request=request) + operation = await client.delete_entity_type(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_sync.py index 88ee670f8d..c3b3afb7d3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_async.py index bb699fe971..55da7e7a8a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_feature(): ) # Make the request - operation = client.delete_feature(request=request) + operation = await client.delete_feature(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_sync.py index a848d34b1b..b905790986 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_async.py index 6121c6d78d..7f725b4b6e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_delete_feature_values(): ) # Make the request - operation = client.delete_feature_values(request=request) + operation = await client.delete_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_sync.py index d16997edfb..71bc92bc70 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_async.py index d1f9804ce5..fa9c330017 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_featurestore(): ) # Make the request - operation = client.delete_featurestore(request=request) + operation = await client.delete_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_sync.py index 9dec556a53..8e2ce99295 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_delete_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_async.py index 61365844f9..134c7a13a1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,11 +52,11 @@ async def sample_export_feature_values(): ) # Make the request - operation = client.export_feature_values(request=request) + operation = await client.export_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_sync.py index b30392fdb5..90b225ad86 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_export_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_async.py index 0505584f0c..35bcc82ece 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_sync.py index ede7cfcc4a..b79f259062 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_async.py index 4eb15ddc0d..df70990c4a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_sync.py index 29adec8248..040938b397 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_async.py index 99ec384953..1ca09dc191 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_sync.py index b10d33c566..b91621e085 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_get_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_async.py index 24c36c0913..0220e7df73 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -53,11 +53,11 @@ async def sample_import_feature_values(): ) # Make the request - operation = client.import_feature_values(request=request) + operation = await client.import_feature_values(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_sync.py index 9aa7ff7777..897cfcebcc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_import_feature_values_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_async.py index 90fe8f9c13..34ca77bae4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_sync.py index 2a61fc4b12..b4a964c574 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_entity_types_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_async.py index 1695ef3116..82c0ffa1d9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_sync.py index b7a972e6b7..0d24381c4a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_async.py index aa6c281b5d..1af830d682 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_sync.py index 3033b361ca..1b30e21645 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_list_featurestores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_async.py index 1ad9aab938..c625a3b254 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_sync.py index 5c2f3c5e62..394141ce61 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_search_features_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_async.py index 822a7cd74b..d484387d64 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_sync.py index f8e035759c..4baa2a873e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_entity_type_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_async.py index acfb6612b6..6238316f0b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_sync.py index 617ec50e4f..976720cb79 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_feature_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_async.py index 97f9d79079..e8c7745588 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_featurestore(): ) # Make the request - operation = client.update_featurestore(request=request) + operation = await client.update_featurestore(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_sync.py index f7f574f78d..d2b541e093 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_featurestore_service_update_featurestore_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_async.py index 288044546d..263b4cbf2c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_sync.py index 68e6a6bf45..061d9f986f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_create_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_async.py index 79f6bc26eb..93bffbb08e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_sync.py index 518d71811e..942c21cedf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_delete_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_async.py index da3962d2bf..9f2b43e952 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_sync.py index ea8f3943f1..aabf4627bf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_get_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_async.py index 3236966da1..93ad2eca52 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_sync.py index 51ba5d0623..0bc236ce47 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_list_cached_contents_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_async.py index be600d3fa3..1e590ecd58 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_sync.py index ec94e4dcb4..b142e4c1f9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_cache_service_update_cached_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py index 77bcd993a1..a11f55bc37 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py index c48f2e3aae..3f5e4aa32c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_cancel_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_async.py index d8e12ec220..a23544e031 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_sync.py index 1e65a918ea..cf5b4a94e5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_create_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_async.py index 7fb2cef679..8a6288f231 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_sync.py index c9e404a689..8fd4e08f61 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_get_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py index 1c625524af..c6cad50f7e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py index d792d19335..1ad989edf8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_list_tuning_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py index 3ccae978dc..c3bc4c1bf4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_rebase_tuned_model(): ) # Make the request - operation = client.rebase_tuned_model(request=request) + operation = await client.rebase_tuned_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py index 19655f24af..ec2bdb8405 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_gen_ai_tuning_service_rebase_tuned_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_async.py index 48f7de5ee3..c924ab4b9e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_index_endpoint(): ) # Make the request - operation = client.create_index_endpoint(request=request) + operation = await client.create_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_sync.py index cac38a2681..25d6b87d6d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_create_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_async.py index 4a9e023ec7..9049511238 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_index_endpoint(): ) # Make the request - operation = client.delete_index_endpoint(request=request) + operation = await client.delete_index_endpoint(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_sync.py index 7062dee68f..fc5e5f1919 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_delete_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_async.py index f386f1639f..1d1c83f8f1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_deploy_index(): ) # Make the request - operation = client.deploy_index(request=request) + operation = await client.deploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_sync.py index 0432a5b1dd..65d502e20a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_deploy_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_async.py index a38ebd56f0..ad7a8b2a78 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_sync.py index 73a921c471..82115205f0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_get_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_async.py index 2eb137e1c8..992e63e153 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_sync.py index 30257b39f4..b65f3ded9a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_list_index_endpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_async.py index 18bcb85718..57315fc45c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_mutate_deployed_index(): ) # Make the request - operation = client.mutate_deployed_index(request=request) + operation = await client.mutate_deployed_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_sync.py index f8388243c1..184974ef4c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_mutate_deployed_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_async.py index 33414ac92f..72d9eb7d45 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_undeploy_index(): ) # Make the request - operation = client.undeploy_index(request=request) + operation = await client.undeploy_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_sync.py index b5f7638b47..79fb4de37d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_undeploy_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_async.py index 731cb18f50..cd848eb071 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_sync.py index 02faa53bbd..f23656a33f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_endpoint_service_update_index_endpoint_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_async.py index 063f8d5f3a..f65d94af82 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_index(): ) # Make the request - operation = client.create_index(request=request) + operation = await client.create_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_sync.py index eba212b223..910cae4de0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_create_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_async.py index 7758700546..eed56f7541 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_index(): ) # Make the request - operation = client.delete_index(request=request) + operation = await client.delete_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_sync.py index 6089f2312d..47b840bbc7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_delete_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_async.py index 85af54e5fd..ace73a9a1a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_sync.py index c7baed225a..665b031c72 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_async.py index 7dd4720d66..d6dc010c76 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_import_index(): ) # Make the request - operation = client.import_index(request=request) + operation = await client.import_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_sync.py index f849ffe610..4259686554 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_import_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_async.py index 9a914c2902..34f840d1e2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_sync.py index bc5a4a491b..da7be9d916 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_list_indexes_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_async.py index fe8057b5bb..c7ade077e9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_sync.py index a2c15bede4..5247794d02 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_remove_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_async.py index fa4a6ab706..5ef59cd732 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_index(): ) # Make the request - operation = client.update_index(request=request) + operation = await client.update_index(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_sync.py index b93f2db487..2be68ec123 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_update_index_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_async.py index be2f480ece..07a56e5dd8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_sync.py index dff79afb31..afae738c0c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_index_service_upsert_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_async.py index 10e57e5fa3..0910b05bfd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_sync.py index 846d8faf10..8105153b71 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_async.py index 6db27b6f25..7fdb9b6441 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_sync.py index add8d71dee..3faddf5611 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_async.py index b10cfc1aeb..737adc5cf9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_sync.py index 57073f9801..1fd248d23e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_async.py index 9a5f115519..4ae073fa0e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py index be7e66d17b..6c69ae52e4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_async.py index 8a438d1d28..0480206601 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_sync.py index 39c5361104..90c84705a5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_cancel_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_async.py index eb9334ce64..0ccee0fe51 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_sync.py index 2cc981c55a..adab9e2ccb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_async.py index d47541973b..4cbe718eac 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_sync.py index 7ee22ae33f..1d222f9005 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_async.py index 91f838c3b1..1af8dae084 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_sync.py index 2961d07a7d..7cacbec848 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_async.py index c8c453631b..2b3a775fdd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_sync.py index 97ab2840ea..a7f075f0f6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_async.py index a4597e2fc1..f4a828c3dd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_sync.py index d37a4779de..0cf5b9b3df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_async.py index f56303f479..a24a58d2e0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_sync.py index 19528a8aed..19d3c4a09a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_create_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_async.py index 3d8fa825ee..65b452d651 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_batch_prediction_job(): ) # Make the request - operation = client.delete_batch_prediction_job(request=request) + operation = await client.delete_batch_prediction_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_sync.py index ec7bf67527..20760c705d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_async.py index f49bc736f9..1605bfceba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_custom_job(): ) # Make the request - operation = client.delete_custom_job(request=request) + operation = await client.delete_custom_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_sync.py index 902562c568..e9f3b6db11 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_async.py index 10b7a2a28f..fab9545e2c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_data_labeling_job(): ) # Make the request - operation = client.delete_data_labeling_job(request=request) + operation = await client.delete_data_labeling_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_sync.py index 48e8306caa..2ae61c28fc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_async.py index 6f15f81a3d..31dba7c1a2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_hyperparameter_tuning_job(): ) # Make the request - operation = client.delete_hyperparameter_tuning_job(request=request) + operation = await client.delete_hyperparameter_tuning_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_sync.py index a293877505..cec49ead2e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_async.py index 164246a6aa..5fd53b4514 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_deployment_monitoring_job(): ) # Make the request - operation = client.delete_model_deployment_monitoring_job(request=request) + operation = await client.delete_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_sync.py index 7e6fefa82f..8292d3fcba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_async.py index 056d5c0751..ab8e62657a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_nas_job(): ) # Make the request - operation = client.delete_nas_job(request=request) + operation = await client.delete_nas_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_sync.py index b67ffd72da..99b1473c0b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_delete_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_async.py index 6f96feec00..e25d2e359b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_sync.py index fe0ca28d44..6737abab23 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_batch_prediction_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_async.py index 7850df354a..ad6cd139f4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_sync.py index 0a242a00fc..cff9259648 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_custom_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_async.py index 55a27e2d06..4c874e7eea 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_sync.py index 1e241d16ba..007787d67c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_data_labeling_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_async.py index 1fe464e248..7fb987110b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_sync.py index dd497b506c..2adea101ed 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_async.py index 34e3ecdbfc..6062246baa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_sync.py index 10a6af9bc1..e3590e2ed1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_async.py index a0f5e83483..0f72a10c7b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_sync.py index aababf4a4b..048ba07389 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_async.py index 2479556adb..6a12836537 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_sync.py index 289fe8af34..893f0e7e9a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_nas_trial_detail_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_async.py index ce5c53c1e3..06886f84df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_sync.py index 1e16a816f2..046a5c488c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_batch_prediction_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_async.py index a099e6b2a0..bcd7d89cec 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_sync.py index 48b2832213..04669bfdb6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_async.py index b6e6ece756..3187ac4de9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_sync.py index 304fb2ee22..3ebf84cfe0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_data_labeling_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_async.py index eb4065d53c..a985e54138 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py index ab0be5b6ea..4b9d1e02d9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_hyperparameter_tuning_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_async.py index 62c63e13ff..4dc786b84f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py index 367524c525..b7ef42d0bb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_model_deployment_monitoring_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_async.py index fe00e46478..6006649b78 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_sync.py index f1ad5dfc4e..6b920bd297 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_async.py index 8b9156b468..40822f6fe5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_sync.py index b5e09f4cb3..e9200d182a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_nas_trial_details_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_async.py index f2753d16b5..390acbca92 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_sync.py index 843932c062..97630cb824 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_pause_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_async.py index 691eb04c03..86b5aa27fd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_sync.py index fe74c2a59a..fb86f751f6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_resume_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py index 15512cd7d0..b56337f1ab 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py index e82c635761..6c933978c7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_search_model_deployment_monitoring_stats_anomalies_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_async.py index 9c5a594c48..0b10345937 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_model_deployment_monitoring_job(): ) # Make the request - operation = client.update_model_deployment_monitoring_job(request=request) + operation = await client.update_model_deployment_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_sync.py index 989835aa14..d00ff8c7aa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_async.py index c004173439..2f2efc2b5c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_sync.py index bb03e688e2..8861b65803 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_llm_utility_service_compute_tokens_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_async.py index 7b40b0aa83..c762fed339 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_sync.py index 6404625536..51c937e41d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_find_neighbors_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_async.py index 7cbec2721f..300ff93090 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_sync.py index 7f08900add..a5f527cee1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_match_service_read_index_datapoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_async.py index bcd1008dd5..caabdb1a0d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_memory(): ) # Make the request - operation = client.create_memory(request=request) + operation = await client.create_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_sync.py index 70e9438ab3..115c66a712 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_create_memory_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_async.py index 8b6cedd8ed..1a7dba3c5d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_memory(): ) # Make the request - operation = client.delete_memory(request=request) + operation = await client.delete_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_sync.py index 3566c7bfc2..9b0d1f4f7e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_delete_memory_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_async.py index 3f791fcc97..baaeecf037 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_generate_memories(): ) # Make the request - operation = client.generate_memories(request=request) + operation = await client.generate_memories(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_sync.py index 18e03c81d7..874c5717cf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_generate_memories_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_async.py index 5bd3d30f3c..15c3425f65 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_sync.py index 4a9ade4833..1faf27a1da 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_get_memory_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_async.py index 7041ca6fdc..edb5169551 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_sync.py index 6a870188d8..d8e22a61bc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_list_memories_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_async.py index 89ce8ef789..16095fed91 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_sync.py index 66fe1fb86d..859c266118 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_retrieve_memories_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_async.py index d882b40bd7..56396a5a9b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_memory(): ) # Make the request - operation = client.update_memory(request=request) + operation = await client.update_memory(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_sync.py index dd07b2bafe..0e24629023 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_memory_bank_service_update_memory_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_async.py index 4e3b4f7eea..f6a8e58cf9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_sync.py index fbf59ba627..dce5224228 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_artifacts_and_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_async.py index 2e9fea74c3..fa96c41b35 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_sync.py index 458e1f286a..7705dd896a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_context_children_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_async.py index 41870589d6..3e2e8aaf4f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_sync.py index 7791ef4613..af259ad566 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_add_execution_events_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_async.py index dd5c51ba4f..05f144a187 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_sync.py index 80d073444d..71d4fd6de0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_async.py index c4d642aa9d..f99a213a36 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_sync.py index a00bba5d6e..b07fadbf16 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_async.py index 0f5e96bda7..ba58d10f57 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_sync.py index 5521bb84be..47114678bd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_async.py index a7f00f8f5c..62b285ea42 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_sync.py index cadbb30026..8e248529bf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_async.py index 7487b1506c..f48ebaa743 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_create_metadata_store(): ) # Make the request - operation = client.create_metadata_store(request=request) + operation = await client.create_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_sync.py index 4ee6a9e928..65e00fb522 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_create_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_async.py index c3326dc7ce..4b44897c11 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_artifact(): ) # Make the request - operation = client.delete_artifact(request=request) + operation = await client.delete_artifact(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_sync.py index 52b7579dec..20429280df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_async.py index f576551efc..be8a013164 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_context(): ) # Make the request - operation = client.delete_context(request=request) + operation = await client.delete_context(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_sync.py index bf6dd2dcc5..8f03e8f471 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_async.py index 27829e516e..70464606d0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_execution(): ) # Make the request - operation = client.delete_execution(request=request) + operation = await client.delete_execution(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_sync.py index 51d4e8133b..1d9edf5c2b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_async.py index 6d3e6e1085..83ce34570a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_metadata_store(): ) # Make the request - operation = client.delete_metadata_store(request=request) + operation = await client.delete_metadata_store(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_sync.py index bc6926e753..f3fdf346d1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_delete_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_async.py index bbe696ede7..52e5a2dbca 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_sync.py index 34272385c0..9a9284b18a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_async.py index 61339b41bf..8e7f80066c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_sync.py index 5bad305663..060b2f35b7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_async.py index ece1a764a4..e986e6f1f2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_sync.py index db677a78b1..7e3eddffe5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_async.py index a99fccd062..5b0a435ad3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_sync.py index 24acdd30a0..ad0dc3e028 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_async.py index c074480ba1..6e3835b6bf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_sync.py index ea3d1457f9..68919a0971 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_get_metadata_store_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_async.py index 6cfe00a208..a2cae459fe 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_sync.py index 2673d4c43c..a02b748ed4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_artifacts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_async.py index 146700af12..798b1ec2d3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_sync.py index f883d4f23b..d0e6b09047 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_async.py index b3c1f04473..f9e3b5f126 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_sync.py index 015b1232b8..03145dc08d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_async.py index 7cdfe822d8..d908b7b5b3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_sync.py index 7db17d9b49..dbd6fc9911 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_schemas_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_async.py index 09cce8e693..263904031e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_sync.py index 9f5ccb8276..5095f0019a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_list_metadata_stores_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_async.py index 84248c8b31..fe14afd950 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_artifacts(): ) # Make the request - operation = client.purge_artifacts(request=request) + operation = await client.purge_artifacts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_sync.py index 85a8542c42..122fbcda15 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_artifacts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_async.py index 93e978c768..aa6cf60e12 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_contexts(): ) # Make the request - operation = client.purge_contexts(request=request) + operation = await client.purge_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_sync.py index 2d10905ffc..d18ae9e803 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_async.py index 9fadadf7c2..2ad98ccf28 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_purge_executions(): ) # Make the request - operation = client.purge_executions(request=request) + operation = await client.purge_executions(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_sync.py index f64351d7dc..23c3b673f8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_purge_executions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_async.py index ea6029dd04..fa541ea6ac 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py index 18a0889922..c296ad28a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_artifact_lineage_subgraph_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_async.py index 55306ef1b7..b6d0476b7b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_sync.py index 31b0dba929..7ceca9df3c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_context_lineage_subgraph_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_async.py index 0f9686fc75..599ca62bee 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py index dc65c08124..7082acc14b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_query_execution_inputs_and_outputs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_async.py index b9cc06a294..ed845de837 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_sync.py index ab8230954a..c219467a90 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_remove_context_children_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_async.py index 77da6622eb..2547d4d40b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_sync.py index e55aae8a35..61cf235537 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_artifact_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_async.py index d65d55d97d..6ae9ee4546 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_sync.py index a0ecb8e82b..b1a0959e68 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_context_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_async.py index 1412eeb754..b56455f8e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_sync.py index f71a9f96d4..a52f117ebc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_metadata_service_update_execution_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_async.py index 0214f23b3d..dd2e80d590 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_batch_migrate_resources(): ) # Make the request - operation = client.batch_migrate_resources(request=request) + operation = await client.batch_migrate_resources(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_sync.py index a279b744ba..81a0a074eb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_batch_migrate_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_async.py index b90ef68165..9543ba417a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_sync.py index 68831aa6d7..0e5edbfea8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_migration_service_search_migratable_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_async.py index 7a1f421839..39b4c204ab 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_sync.py index 2578817b90..18c72cb562 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_accept_publisher_model_eula_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_async.py index 3153413503..37e0b6514a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_sync.py index 3ea8b660dc..69968417af 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_check_publisher_model_eula_acceptance_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_async.py index 6f503888ce..c1a2226296 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_deploy(): ) # Make the request - operation = client.deploy(request=request) + operation = await client.deploy(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_async.py index f529316ea8..9eae8292cd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_deploy_publisher_model(): ) # Make the request - operation = client.deploy_publisher_model(request=request) + operation = await client.deploy_publisher_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_sync.py index 759a3abaa2..58f22548e2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_publisher_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_sync.py index c4f260d956..e077a44db3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_deploy_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_async.py index f6d46c7db7..efb979ad05 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_export_publisher_model(): ) # Make the request - operation = client.export_publisher_model(request=request) + operation = await client.export_publisher_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_sync.py index e9c2523423..87728e3094 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_export_publisher_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_async.py index ef06ffe89a..b2214bc74a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_sync.py index 246d457b37..dd21fdb282 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_get_publisher_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_async.py index 34e09fdca8..9c774a5cb4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_sync.py index c3b223e6c4..dfccc595b0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_garden_service_list_publisher_models_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_async.py index 94d821176e..d15406a68a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_create_model_monitor(): ) # Make the request - operation = client.create_model_monitor(request=request) + operation = await client.create_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_sync.py index caa2b96bbc..95c72488ab 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_async.py index 91f4ba92f1..d02ac9f024 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_sync.py index 98b0a49ecf..6cfc3ab1f1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_create_model_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_async.py index b88242cc84..84ebb3ecf3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_monitor(): ) # Make the request - operation = client.delete_model_monitor(request=request) + operation = await client.delete_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_sync.py index a3da35f6c1..7b8601a4a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_async.py index 84e294707e..3cc6844ed5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_monitoring_job(): ) # Make the request - operation = client.delete_model_monitoring_job(request=request) + operation = await client.delete_model_monitoring_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_sync.py index 23d4e29a6b..88d1ede235 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_delete_model_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_async.py index 3d571e1392..842fb7facc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_sync.py index 1d02e5d794..cc70c786e1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_async.py index eeed763d16..cab75cbfcc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_sync.py index 321b1c4f3d..4cd28b818e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_get_model_monitoring_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_async.py index a27572a613..4517819239 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_sync.py index 55f52097ed..9158d3e25a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitoring_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_async.py index c2644c539b..e44aadf596 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_sync.py index 202ceb19f7..405cf9c224 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_list_model_monitors_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_async.py index 6f6444b99c..da1e40d89d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_sync.py index 8b0a2fd76c..b60cee8c6f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_alerts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_async.py index f3acfa6138..26d10e7cfb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_sync.py index 246c2c2d91..456336f108 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_search_model_monitoring_stats_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_async.py index 9f83cf0bc2..82abdba0ee 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_model_monitor(): ) # Make the request - operation = client.update_model_monitor(request=request) + operation = await client.update_model_monitor(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_sync.py index 5fd08bb047..c4571a7778 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_monitoring_service_update_model_monitor_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_async.py index e17d81995c..02739100fa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_sync.py index cb17e25f36..e8dc3d25eb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_evaluated_annotations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_async.py index acd1842a64..ed9187edea 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_sync.py index a6cdaa1aa4..77b03cdc93 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_batch_import_model_evaluation_slices_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_async.py index b046850350..51180d616f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,11 +46,11 @@ async def sample_copy_model(): ) # Make the request - operation = client.copy_model(request=request) + operation = await client.copy_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_sync.py index 39a1c5f470..dda02762e0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_copy_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_async.py index 43e64977af..2c84b59528 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model(): ) # Make the request - operation = client.delete_model(request=request) + operation = await client.delete_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_sync.py index fcd6ddcb7f..7469e7f3cc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_async.py index e295a38d89..d5f00e744b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_model_version(): ) # Make the request - operation = client.delete_model_version(request=request) + operation = await client.delete_model_version(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_sync.py index 27dff026fa..87357903b8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_delete_model_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_async.py index fba23ff224..5e1d620003 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_export_model(): ) # Make the request - operation = client.export_model(request=request) + operation = await client.export_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_sync.py index d184f0ef58..d71cb2c10b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_export_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_async.py index 5ae6cafeac..3e7f787480 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_async.py index ee74d62b2f..914fa8c50e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_async.py index cdb84f0816..4e78ec20ba 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_sync.py index c4dd6dbc68..610b752222 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_slice_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_sync.py index 75031a0e9e..be15a9a35c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_evaluation_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_sync.py index 021b20517e..d598c52909 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_get_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_async.py index 7a33175f2a..8eebdb1014 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_sync.py index 9a1d323788..b19689b5e4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_import_model_evaluation_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_async.py index 175712b595..b60da2db5c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_sync.py index dfb2e25067..d2a6409354 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluation_slices_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_async.py index 9121ba0151..68694cac81 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_sync.py index 27dec10265..3f05ac5a37 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_async.py index 4cbe0d2a38..19daa96147 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_sync.py index 7df6fcda5d..d6d98a81f3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_version_checkpoints_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_async.py index e8c0572e35..2342ddbb35 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_sync.py index f8c5602ec2..deb416f306 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_versions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_async.py index 22c0d2f23f..2f029f39ac 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_sync.py index f7b50f449a..012a75b322 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_models_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_async.py index 4812f78d43..a0b87f5579 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_sync.py index 5e5dd1a888..8ff0c06d6b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_merge_version_aliases_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_async.py index e12120e6d1..69b8e588ad 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_sync.py index 357a64a1a3..5c05194829 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_recommend_spec_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_async.py index 93580a8898..67ca870fc9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_update_explanation_dataset(): ) # Make the request - operation = client.update_explanation_dataset(request=request) + operation = await client.update_explanation_dataset(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_sync.py index ea06d57225..a0eb1b50b7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_explanation_dataset_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_async.py index 88378ae0b5..329a13a37e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_sync.py index 815f06296a..e098984d37 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_update_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_async.py index df9087f31b..a65b7fe852 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_upload_model(): ) # Make the request - operation = client.upload_model(request=request) + operation = await client.upload_model(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_sync.py index 55b3553aef..709b85fcd4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_model_service_upload_model_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_async.py index 1f56201b8f..dd0be9cd01 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_assign_notebook_runtime(): ) # Make the request - operation = client.assign_notebook_runtime(request=request) + operation = await client.assign_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_sync.py index d8c957a6ac..b7cee4fd9b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_assign_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_async.py index 9d2c26be1f..ee1624deb9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_create_notebook_execution_job(): ) # Make the request - operation = client.create_notebook_execution_job(request=request) + operation = await client.create_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_sync.py index 0a5c899491..67425ae74c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_async.py index a656e015c8..70010c8ffe 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_notebook_runtime_template(): ) # Make the request - operation = client.create_notebook_runtime_template(request=request) + operation = await client.create_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_sync.py index 0be2edd675..bcb7c8f179 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_create_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_async.py index dfca45a19e..58a6dd0287 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_execution_job(): ) # Make the request - operation = client.delete_notebook_execution_job(request=request) + operation = await client.delete_notebook_execution_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_sync.py index 4ab149c9ba..6a6b32be3f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_async.py index 4212b0367e..ab6499bba5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_runtime(): ) # Make the request - operation = client.delete_notebook_runtime(request=request) + operation = await client.delete_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_sync.py index 606f6f91f6..4bc34f219f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_async.py index c8e64e36ed..f249eced6b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_notebook_runtime_template(): ) # Make the request - operation = client.delete_notebook_runtime_template(request=request) + operation = await client.delete_notebook_runtime_template(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_sync.py index 1ac043e9f1..4b6045f4c4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_delete_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_async.py index 38f64f1495..bc825f6f20 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_sync.py index e7cc99c7e6..c7d4010637 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_execution_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_async.py index 5ae1690e07..1a10e7db9b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_sync.py index 51b5ecd101..b4b0909670 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_async.py index 596576107e..08f1173f04 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_sync.py index 1a7ff31ace..e287470bfc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_get_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_async.py index 4d85e54968..a640e64bfe 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_sync.py index d085cfc4de..1285b983f0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_execution_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_async.py index 4dea2fccb3..521b8965f3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_sync.py index 69dfe5dfed..a7c13aefa6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtime_templates_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_async.py index a1fe104576..15d50adb45 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_sync.py index 89a282606f..13c8df83f7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_list_notebook_runtimes_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_async.py index 10a56847a2..4984010eb7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_start_notebook_runtime(): ) # Make the request - operation = client.start_notebook_runtime(request=request) + operation = await client.start_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_sync.py index 1367c3b712..9f8dac283e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_start_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_async.py index 4b2780a416..fcfa1bcb65 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_stop_notebook_runtime(): ) # Make the request - operation = client.stop_notebook_runtime(request=request) + operation = await client.stop_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_sync.py index 970a3f8526..ee8e956122 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_stop_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_async.py index 8925f7ff59..269ea345f1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_sync.py index cdcc25e62f..8678354277 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_update_notebook_runtime_template_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_async.py index 37b6c82b08..a2aed9cf72 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_upgrade_notebook_runtime(): ) # Make the request - operation = client.upgrade_notebook_runtime(request=request) + operation = await client.upgrade_notebook_runtime(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_sync.py index ef9a07d258..037a7357d8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_notebook_service_upgrade_notebook_runtime_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_async.py index 9ce6e573d2..4d68c8d9e6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_activate_online_evaluator(): ) # Make the request - operation = client.activate_online_evaluator(request=request) + operation = await client.activate_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_sync.py index 148fded2bd..05888a6fc6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_activate_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_async.py index 163c43b949..549cdca352 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -51,11 +51,11 @@ async def sample_create_online_evaluator(): ) # Make the request - operation = client.create_online_evaluator(request=request) + operation = await client.create_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_sync.py index 532edbf46d..9957217a73 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_create_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_async.py index bdc65b97c3..7c5293f673 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_online_evaluator(): ) # Make the request - operation = client.delete_online_evaluator(request=request) + operation = await client.delete_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_sync.py index 448e634d77..3aaa0bd3b1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_delete_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_async.py index 76af0dfbbf..49bb0561ff 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_sync.py index f2af842b06..bf9225272d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_get_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_async.py index ef60ff310c..eb1e36cf36 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_sync.py index 6b3b054a3a..04363a765d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_list_online_evaluators_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_async.py index cd379568cb..0fb244b756 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_suspend_online_evaluator(): ) # Make the request - operation = client.suspend_online_evaluator(request=request) + operation = await client.suspend_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_sync.py index 2370dbe663..0b74bbda16 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_suspend_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_async.py index 1941db6d3b..e0d4f8d404 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_update_online_evaluator(): ) # Make the request - operation = client.update_online_evaluator(request=request) + operation = await client.update_online_evaluator(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_sync.py index dc30426667..8361fcac95 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_online_evaluator_service_update_online_evaluator_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_async.py index 4310fab893..021a965769 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_create_persistent_resource(): ) # Make the request - operation = client.create_persistent_resource(request=request) + operation = await client.create_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_sync.py index ca7b289916..b243e27c79 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_create_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_async.py index f6fca8fc5c..3f3cc6445f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_persistent_resource(): ) # Make the request - operation = client.delete_persistent_resource(request=request) + operation = await client.delete_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_sync.py index 1239a0bc57..040b8e3058 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_delete_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_async.py index 7f66983b78..365d95b022 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_sync.py index 1a33f6e38e..a389f36152 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_get_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_async.py index 098bea32f8..aeabbd2deb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_sync.py index acd55f96e0..234dd758aa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_list_persistent_resources_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_async.py index 21219365d4..292856562e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_reboot_persistent_resource(): ) # Make the request - operation = client.reboot_persistent_resource(request=request) + operation = await client.reboot_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_sync.py index 4d4f4e9d83..aaf3c9f509 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_reboot_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_async.py index 6da8e6ca23..f9bcfe7af4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_persistent_resource(): ) # Make the request - operation = client.update_persistent_resource(request=request) + operation = await client.update_persistent_resource(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_sync.py index 1b4e676d24..273c30b21e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_persistent_resource_service_update_persistent_resource_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py index 15f327cb35..5a8e90d0c1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_cancel_pipeline_jobs(): ) # Make the request - operation = client.batch_cancel_pipeline_jobs(request=request) + operation = await client.batch_cancel_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py index 12bc61de76..7abfb39790 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_cancel_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py index 058390c67c..063f532882 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_delete_pipeline_jobs(): ) # Make the request - operation = client.batch_delete_pipeline_jobs(request=request) + operation = await client.batch_delete_pipeline_jobs(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py index 0dbf96e4bf..900f99fd02 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_batch_delete_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_async.py index f096d0dc31..9f47c870c5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_sync.py index 7060d39dad..906b736946 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_async.py index 86a874e44b..339d7542ca 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_sync.py index 484efa6dd4..c0a59f901f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_cancel_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_async.py index daaec9340e..073bfc8041 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_sync.py index 05663ad5c7..649b0736fd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_async.py index dd618c8130..4c7997f599 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_sync.py index b302e31099..a3c5451e3c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_create_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_async.py index 633174944c..a7e429dfc0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_pipeline_job(): ) # Make the request - operation = client.delete_pipeline_job(request=request) + operation = await client.delete_pipeline_job(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_sync.py index be2d0e2a5b..450e91ebaa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_async.py index 8cf4f0770f..09dc5b4695 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_training_pipeline(): ) # Make the request - operation = client.delete_training_pipeline(request=request) + operation = await client.delete_training_pipeline(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_sync.py index 691a603a21..fba43ec893 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_delete_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_async.py index 04ec0a2ae7..aa1f1d11d9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_sync.py index 1a8ac99a00..e7aa2f3fd4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_pipeline_job_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_async.py index 56688b78ff..17f14b8d64 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_sync.py index a34c62b81e..79ca682c87 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_get_training_pipeline_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_async.py index 95e6848082..14952ba950 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_sync.py index aa870efb5a..423ecef4a4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_pipeline_jobs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_async.py index 83483dc29f..8081cda4b0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_sync.py index f5a46daa77..91556806c8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_pipeline_service_list_training_pipelines_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_async.py index b4ea6dac56..94078f6667 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_sync.py index 93e237cf92..fbde8140a1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_chat_completions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_async.py index d803800c05..7bde05144a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_sync.py index 7816885898..fe19cda27e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_count_tokens_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_async.py index fb2ccf15d2..37639b3c1e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_sync.py index 2823aa64b6..c264d21779 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_async.py index 200aafbe18..0b3fb9d8f6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_sync.py index 9bdf134c40..fb69768052 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_direct_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_async.py index 5e0e37b291..0c757cd26b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_sync.py index 33fa3b3110..9873ba1c08 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_embed_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_async.py index 36b4f59599..fb1b1b3ed6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_sync.py index 849c43599e..c8448c5fc8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_explain_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_async.py index e476a86e70..2002543610 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_sync.py index 6c381afcbe..a20a2cd8d4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_generate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_async.py index 9658eb2b9e..3661ea8768 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_sync.py index d02ef228d3..ffd15a475f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_async.py index a39e8ec270..144292b725 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_sync.py index 2ca97a4f35..0533b9446c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_async.py index d442335b38..b9cc464040 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_sync.py index 68a248ac4c..528c530a2d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_server_streaming_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_async.py index 2428267a44..4c06dbc291 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_sync.py index 47d0a1fc3c..ce05a7565c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_async.py index 550b97a419..29a1f3027b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_sync.py index 6761322041..d8c0ccf5a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_direct_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_async.py index 1603857232..bbf8c01b5b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_sync.py index 6c610c5ab8..a0443b4c0b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_generate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_async.py index 634d008406..4937a7e48a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_sync.py index fef0822890..1fd21c4497 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_stream_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_async.py index e917389f2c..e65175d56d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_sync.py index e3d469967f..5f63b84f09 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_async.py index c2f23d6677..e5e8cf997c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_sync.py index 60402d9a2c..75abf0fc1e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_prediction_service_streaming_raw_predict_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py index 1558923d0a..1d8bbce267 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_async_query_reasoning_engine(): ) # Make the request - operation = client.async_query_reasoning_engine(request=request) + operation = await client.async_query_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py index 57709eacda..62e22040bf 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py new file mode 100644 index 0000000000..3fb808f448 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelAsyncQueryReasoningEngine +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_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 aiplatform_v1beta1 + + +async def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = await client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_async] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py new file mode 100644 index 0000000000..84011a0f08 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelAsyncQueryReasoningEngine +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_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 aiplatform_v1beta1 + + +def sample_cancel_async_query_reasoning_engine(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineExecutionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Make the request + response = client.cancel_async_query_reasoning_engine(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py index 5c2860f9bb..0ac967d80e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py index cb73431d9d..070aed197a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py index 793d7dc980..4f72d864ac 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py index cc22742afb..6795eb3528 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_async.py new file mode 100644 index 0000000000..b9bd192ca3 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteReasoningEngineRuntimeRevision +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_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 aiplatform_v1beta1 + + +async def sample_delete_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + operation = await client.delete_reasoning_engine_runtime_revision(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_async] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_sync.py new file mode 100644 index 0000000000..817b6d36bc --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteReasoningEngineRuntimeRevision +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_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 aiplatform_v1beta1 + + +def sample_delete_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_reasoning_engine_runtime_revision(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_sync] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_async.py new file mode 100644 index 0000000000..4aa1a06f57 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetReasoningEngineRuntimeRevision +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_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 aiplatform_v1beta1 + + +async def sample_get_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_reasoning_engine_runtime_revision(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_async] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_sync.py new file mode 100644 index 0000000000..f3698b424e --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetReasoningEngineRuntimeRevision +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_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 aiplatform_v1beta1 + + +def sample_get_reasoning_engine_runtime_revision(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Make the request + response = client.get_reasoning_engine_runtime_revision(request=request) + + # Handle the response + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_sync] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_async.py new file mode 100644 index 0000000000..422d5b46c4 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListReasoningEngineRuntimeRevisions +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_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 aiplatform_v1beta1 + + +async def sample_list_reasoning_engine_runtime_revisions(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reasoning_engine_runtime_revisions(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_async] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_sync.py new file mode 100644 index 0000000000..0ae35365d2 --- /dev/null +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListReasoningEngineRuntimeRevisions +# 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-aiplatform + + +# [START aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_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 aiplatform_v1beta1 + + +def sample_list_reasoning_engine_runtime_revisions(): + # Create a client + client = aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient() + + # Initialize request argument(s) + request = aiplatform_v1beta1.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reasoning_engine_runtime_revisions(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_sync] diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_async.py index f4f955535b..430cc2b4e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_reasoning_engine(): ) # Make the request - operation = client.create_reasoning_engine(request=request) + operation = await client.create_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_sync.py index 6cf5bf76e1..a11701478d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_create_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_async.py index 26cc98d05e..ba53548d46 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_reasoning_engine(): ) # Make the request - operation = client.delete_reasoning_engine(request=request) + operation = await client.delete_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py index 186bdd1026..e90f392e93 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_delete_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_async.py index 12e145d741..544a65928a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_sync.py index a3a4f68283..718aaa732a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_get_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_async.py index 30c2dd5d02..284678d489 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_sync.py index cfa3836fec..b8315fadcd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_list_reasoning_engines_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_async.py index bb1e6de898..6bfdb4b222 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_reasoning_engine(): ) # Make the request - operation = client.update_reasoning_engine(request=request) + operation = await client.update_reasoning_engine(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_sync.py index 56e42eecca..f90cf9c97b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_reasoning_engine_service_update_reasoning_engine_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_async.py index 2e39d164df..699793b496 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_sync.py index 9b12c5b37e..5c99ee24de 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_create_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_async.py index 04c0e79847..02ca0531cb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_schedule(): ) # Make the request - operation = client.delete_schedule(request=request) + operation = await client.delete_schedule(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_sync.py index b36989096e..41d1ca8c8d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_delete_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_async.py index a06feadc6f..95d16d5a02 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_sync.py index b72e2c8b67..ee2819eef0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_get_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_async.py index 2138707257..f8c94cfe07 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_sync.py index 159b0f029f..6450a322df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_list_schedules_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_async.py index 977423f87f..0f4797a4f8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_sync.py index f02c6cd875..a7fe41b34b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_pause_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_async.py index 024f669673..dd40e39519 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_sync.py index 1e0631b7ea..54089e6b05 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_resume_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_async.py index 9246dbc675..40d38e0eb1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_sync.py index 884676ead3..d846334548 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_schedule_service_update_schedule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_async.py index adc1176bdd..4b95332e28 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_sync.py index bcfd0b2c59..ac4b3882c0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_append_event_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_async.py index babe535460..47a792e631 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_session(): ) # Make the request - operation = client.create_session(request=request) + operation = await client.create_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_sync.py index 8387016976..7d58024e00 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_create_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_async.py index 95cbe6db62..025b74c057 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_session(): ) # Make the request - operation = client.delete_session(request=request) + operation = await client.delete_session(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_sync.py index d3e7eb84bf..ab9300521d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_delete_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_async.py index 0b73f7ca6d..42e1462556 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_sync.py index 00e8c631d8..d4f8f81f7b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_get_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_async.py index bbbb19fc34..fbad3e4fb8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_sync.py index 302377260c..e1e74dcfe7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_events_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_async.py index c211523d3c..a48478bc91 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_sync.py index 340cdace50..376286dec4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_list_sessions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_async.py index 123af45762..f2d6fb7978 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_sync.py index 23d6c48d64..cddbf8d1dc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_session_service_update_session_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_async.py index 543c733fb1..791cbb8810 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_create_specialist_pool(): ) # Make the request - operation = client.create_specialist_pool(request=request) + operation = await client.create_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_sync.py index e0c0ee7314..b578899a89 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_create_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_async.py index 0389fbe310..fbfbcbef1e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_specialist_pool(): ) # Make the request - operation = client.delete_specialist_pool(request=request) + operation = await client.delete_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_sync.py index 6ff4923a71..ffd509fd1b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_delete_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_async.py index b550b6d8e5..c68d945417 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_sync.py index b62f20e802..8e1b65d2b4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_get_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_async.py index bc187b8ba0..ee69c9ec8b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_sync.py index 0e15780460..98c846760e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_list_specialist_pools_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_async.py index 7fbd0c002c..648a6806f6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_update_specialist_pool(): ) # Make the request - operation = client.update_specialist_pool(request=request) + operation = await client.update_specialist_pool(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_sync.py index a447085e6a..ae3201f21e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_specialist_pool_service_update_specialist_pool_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py index 99c7e2c1bf..ce05ab8ba7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py index 62d4e8239b..6d97706fac 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_runs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py index 42a63c2704..80f122f02f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py index 86b51ea30b..96551056a7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_create_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py index 23d3f70024..54c8c3d224 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py index 657f58d3be..d769f80f21 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_batch_read_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_async.py index 693016d3d9..88f5374856 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_tensorboard(): ) # Make the request - operation = client.create_tensorboard(request=request) + operation = await client.create_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_async.py index 46b3b1b1b6..20942dcb47 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_sync.py index 0077b28be4..283918d8b2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_async.py index 922f88874d..ab857206ec 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_sync.py index 1ad43589f6..8a2f19c29d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_sync.py index 8fd456c3d9..f004a51bdc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_async.py index 6515ccb0db..006de16c2f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_sync.py index c65d9482f2..776c1a18d6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_create_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_async.py index 40c126f6f4..1bdd487c6b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard(): ) # Make the request - operation = client.delete_tensorboard(request=request) + operation = await client.delete_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_async.py index 12b88fdcc4..06b4951efb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_experiment(): ) # Make the request - operation = client.delete_tensorboard_experiment(request=request) + operation = await client.delete_tensorboard_experiment(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py index 9add182bf9..bd562a06ce 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_async.py index 1ece69b8b3..1fe7796dec 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_run(): ) # Make the request - operation = client.delete_tensorboard_run(request=request) + operation = await client.delete_tensorboard_run(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_sync.py index 027cf9a6b9..a58564e20f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_sync.py index c15aa9d913..ea9ee8d82c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_async.py index e018a87e62..f181f3aee3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_tensorboard_time_series(): ) # Make the request - operation = client.delete_tensorboard_time_series(request=request) + operation = await client.delete_tensorboard_time_series(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py index 48aa4815c8..5ed8687d7d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_delete_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py index 22e505833e..0447107b40 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py index 85f5eda519..cc4283bc88 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_export_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_async.py index b6216803d0..bc16852ee0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_async.py index 7d1ee18784..9544d139a8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_sync.py index f49b0fb145..3e2ce606ef 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_async.py index b1aa01f38f..6a91a70387 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_sync.py index 9a23c3b199..0a8e8509f7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_sync.py index e823ca6ac4..ca1637f8d9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_async.py index 94f40c6d3b..5982867338 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_sync.py index 5cd8fa4893..576218370d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_get_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_async.py index 9b541fc4a1..21746128a0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_sync.py index 9dd1a601eb..9a848e5ec5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_experiments_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_async.py index 3bca476e73..6e85cd5758 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_sync.py index d11748091e..ec3c1df0a8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_runs_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_async.py index 8ceef5d5d9..202d7bd305 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_sync.py index 194afc0b3a..7abd07aeda 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_async.py index 9db0f3dfa5..39cdffd1ec 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_sync.py index 16908738f0..f7d0748e7f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_list_tensorboards_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_async.py index 7790e0818d..068fb8c791 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py index 4e0ecffc51..940dbbaedd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_async.py index 4e745c3d1b..6cdaded3a1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_sync.py index 96b8ca8bb0..680b369cad 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_size_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py index 10050af693..86c1b60ac7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py index 4ef744e4e6..1120e3fa6b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_time_series_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_async.py index 7d86e308fc..fab6f53d47 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_sync.py index a74022b5b9..34364d94f0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_read_tensorboard_usage_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_async.py index 36dc5f767b..8505d121df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_tensorboard(): ) # Make the request - operation = client.update_tensorboard(request=request) + operation = await client.update_tensorboard(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_async.py index ebd00db421..3d60237c8e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_sync.py index b9293284c1..8b62f2ad6e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_experiment_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_async.py index 0f4cbd6800..45164a09a6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_sync.py index 320ddbd324..d1cdcaf3df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_run_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_sync.py index c7b7a6df53..30e78de617 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_async.py index 7b6c9204c4..59a37d372f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_sync.py index 8966dd7ab4..a8b6f4481a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_update_tensorboard_time_series_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py index 1e8a6df357..cbfb20427d 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py index 53ed1d743e..371e0425e8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_experiment_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_async.py index 9f0f7616d8..0ad792af02 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_sync.py index e8e211bf22..50a08cdaa1 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_tensorboard_service_write_tensorboard_run_data_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_async.py index ca4f551f6b..5e69e7e26e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,11 +49,11 @@ async def sample_batch_create_rag_data_schemas(): ) # Make the request - operation = client.batch_create_rag_data_schemas(request=request) + operation = await client.batch_create_rag_data_schemas(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_sync.py index 1282ef3f7b..770859b3c5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_data_schemas_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_async.py index effef5ae6e..c266974e3a 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_batch_create_rag_metadata(): ) # Make the request - operation = client.batch_create_rag_metadata(request=request) + operation = await client.batch_create_rag_metadata(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_sync.py index bdfadd4763..e845b07032 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_create_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_async.py index 84b4044b40..519d7b78ff 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_delete_rag_data_schemas(): ) # Make the request - operation = client.batch_delete_rag_data_schemas(request=request) + operation = await client.batch_delete_rag_data_schemas(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_sync.py index 283e2e1a34..4448cf26ae 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_data_schemas_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_async.py index 50dd92c760..bdad1bee5e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ async def sample_batch_delete_rag_metadata(): ) # Make the request - operation = client.batch_delete_rag_metadata(request=request) + operation = await client.batch_delete_rag_metadata(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_sync.py index 975c4418b3..49b1445177 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_batch_delete_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_async.py index 7fd5313fe7..06698b91b4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_create_rag_corpus(): ) # Make the request - operation = client.create_rag_corpus(request=request) + operation = await client.create_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_sync.py index 37cc0341aa..d9b37b3923 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_async.py index 03c4c3a6e9..427e80561c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_sync.py index 6952cf378c..dd0b386835 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_data_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_async.py index c6ce2f82ba..25402f7051 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_sync.py index 25e2656576..37592fa0fa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_create_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_async.py index 1994714580..ca208b2fcd 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_rag_corpus(): ) # Make the request - operation = client.delete_rag_corpus(request=request) + operation = await client.delete_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py index 5c2754ce96..f94f03bb63 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_async.py index 0b84847ee1..340b913067 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_sync.py index 0b10a33173..529f9747b5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_data_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_async.py index b258e2582c..d2bf30a8a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_delete_rag_file(): ) # Make the request - operation = client.delete_rag_file(request=request) + operation = await client.delete_rag_file(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_sync.py index 4e4bb90271..0907d19c5f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_async.py index a48725da21..de2cd961c4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_sync.py index 3383de2c8b..cc72af5537 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_delete_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_async.py index 658404caa6..3fd707d9b4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_sync.py index d886491206..a768fd5177 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_async.py index 1098427aa0..b9a53aa10c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_sync.py index b60fddc959..0a1a9aef99 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_data_schema_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_async.py index 131e3afe6c..514616c7d9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py index 25bba21b34..48037f621c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_engine_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_async.py index 6f93f192b3..931e174f78 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_sync.py index 110ed08ae9..0c89b745c6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_async.py index ab557abcc7..9386e43e58 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_sync.py index 3579d71d8f..723fceadb5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_get_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_async.py index 0b4871f0aa..43afb2e156 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,11 +50,11 @@ async def sample_import_rag_files(): ) # Make the request - operation = client.import_rag_files(request=request) + operation = await client.import_rag_files(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_sync.py index dbfeecf727..f259229991 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_import_rag_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_async.py index 055dda95fc..8ae11737cb 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_sync.py index 4412b0279b..20a5e8adab 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_corpora_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_async.py index e4184b593d..ed0cd59f53 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_sync.py index 2dc7793aa6..3b1c902335 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_data_schemas_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_async.py index 9e65996aac..b4f820be8c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_sync.py index 7dc4b8d268..8b75e3d2fc 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_async.py index bf4a15d386..fee2549cb8 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_sync.py index b473f68848..abecc55ef4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_list_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_async.py index 8a209c2c4b..5575966574 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ async def sample_update_rag_corpus(): ) # Make the request - operation = client.update_rag_corpus(request=request) + operation = await client.update_rag_corpus(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_sync.py index 3db798a0f1..cb9cb070a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_corpus_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_async.py index 06228faba2..ba6308369e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,11 +43,11 @@ async def sample_update_rag_engine_config(): ) # Make the request - operation = client.update_rag_engine_config(request=request) + operation = await client.update_rag_engine_config(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py index e8eb93b06a..ac075480ed 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_engine_config_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_async.py index 1d002611fc..376c2351da 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_sync.py index 54791cd9ed..1ecafbc335 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_update_rag_metadata_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_async.py index cd38e80ef2..e94baa3a57 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_sync.py index 3565e1673c..e9cb6d45d4 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_data_service_upload_rag_file_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_async.py index bfc54bca6d..a44c98147c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_sync.py index 09d9009db2..fa40b91966 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_ask_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_async.py index 7456b72cda..634789fb81 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ async def sample_async_retrieve_contexts(): ) # Make the request - operation = client.async_retrieve_contexts(request=request) + operation = await client.async_retrieve_contexts(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_sync.py index c708c6054e..94edf06210 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_async_retrieve_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_async.py index b44334772f..7463a3d5ae 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_sync.py index 4e1797413f..6d4e46dd79 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_augment_prompt_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_async.py index c730168f79..f231eaa9f9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_sync.py index 7aa52223b1..3b721d019c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_corroborate_content_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_async.py index aeeaf6da06..1057b77633 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_sync.py index 9fc91df022..318b2f16aa 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vertex_rag_service_retrieve_contexts_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_async.py index d6e8363476..622f501484 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_sync.py index abfb0834f9..0f84fbcfb3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_add_trial_measurement_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_async.py index 20e1e750bd..98666a5307 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ async def sample_check_trial_early_stopping_state(): ) # Make the request - operation = client.check_trial_early_stopping_state(request=request) + operation = await client.check_trial_early_stopping_state(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_sync.py index 674608bf50..bb958153e5 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_async.py index 2823fe64dd..e17398fad0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_sync.py index f37ba9d97c..b970e354a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_complete_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_async.py index 1f1cbfbb7b..aec43f5d13 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_sync.py index 7ac957f697..9fd6139bd7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_async.py index f3c411e1e0..ce8be39256 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_sync.py index 296aec63ef..ceab2bb9c6 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_create_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_async.py index 6233d9626e..dd10be9335 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_sync.py index cc5b97aad2..1e94291b7e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_async.py index 0553c57f2b..63cc9a9d95 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_sync.py index 8819a7572f..e8ad7c5ab0 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_delete_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_async.py index 9426e9e2db..9552e19bf9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_sync.py index 35c00d630d..483be8b8ec 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_async.py index 1fa6fd63a0..dc3c63539f 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_sync.py index 024c873596..baf12572c9 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_get_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_async.py index 3b5630591d..3f563d74a3 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_sync.py index 90a33b69e2..3551035405 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_optimal_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_async.py index 7b288aa8ec..d0a1212661 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_sync.py index 304e4be7d2..88bdde065b 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_studies_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_async.py index 9903914d29..d2e8449a1c 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_sync.py index 266d6c3f99..654d1014b7 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_list_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_async.py index c81a3fbc55..b0e4fbf77e 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_sync.py index e573e60201..3453de52ff 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_lookup_study_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_async.py index d701a1e0d2..f6cf776e07 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_sync.py index c1a874e56f..49c75eb4df 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_stop_trial_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_async.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_async.py index b5bbc3ee85..47625f5165 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_async.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,11 +46,11 @@ async def sample_suggest_trials(): ) # Make the request - operation = client.suggest_trials(request=request) + operation = await client.suggest_trials(request=request) print("Waiting for operation to complete...") - response = (await operation).result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_sync.py b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_sync.py index 76ac2f0efa..0f48a257f2 100644 --- a/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_sync.py +++ b/samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_suggest_trials_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json index 0f9b93fdac..53753f28da 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.149.0" + "version": "0.0.0" }, "snippets": [ { @@ -41985,6 +41985,159 @@ ], "title": "aiplatform_v1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient", + "shortName": "ReasoningEngineExecutionServiceAsyncClient" + }, + "fullName": "google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient.cancel_async_query_reasoning_engine", + "method": { + "fullName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine", + "service": { + "fullName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "shortName": "ReasoningEngineExecutionService" + }, + "shortName": "CancelAsyncQueryReasoningEngine" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineResponse", + "shortName": "cancel_async_query_reasoning_engine" + }, + "description": "Sample for CancelAsyncQueryReasoningEngine", + "file": "aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceClient", + "shortName": "ReasoningEngineExecutionServiceClient" + }, + "fullName": "google.cloud.aiplatform_v1.ReasoningEngineExecutionServiceClient.cancel_async_query_reasoning_engine", + "method": { + "fullName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine", + "service": { + "fullName": "google.cloud.aiplatform.v1.ReasoningEngineExecutionService", + "shortName": "ReasoningEngineExecutionService" + }, + "shortName": "CancelAsyncQueryReasoningEngine" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1.types.CancelAsyncQueryReasoningEngineResponse", + "shortName": "cancel_async_query_reasoning_engine" + }, + "description": "Sample for CancelAsyncQueryReasoningEngine", + "file": "aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "aiplatform_v1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json index 81c49fac12..bb8afa1c8f 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.149.0" + "version": "0.0.0" }, "snippets": [ { @@ -52216,6 +52216,159 @@ ], "title": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_async_query_reasoning_engine_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient", + "shortName": "ReasoningEngineExecutionServiceAsyncClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.cancel_async_query_reasoning_engine", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "shortName": "ReasoningEngineExecutionService" + }, + "shortName": "CancelAsyncQueryReasoningEngine" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineResponse", + "shortName": "cancel_async_query_reasoning_engine" + }, + "description": "Sample for CancelAsyncQueryReasoningEngine", + "file": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient", + "shortName": "ReasoningEngineExecutionServiceClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.cancel_async_query_reasoning_engine", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService.CancelAsyncQueryReasoningEngine", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "shortName": "ReasoningEngineExecutionService" + }, + "shortName": "CancelAsyncQueryReasoningEngine" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.types.CancelAsyncQueryReasoningEngineResponse", + "shortName": "cancel_async_query_reasoning_engine" + }, + "description": "Sample for CancelAsyncQueryReasoningEngine", + "file": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_cancel_async_query_reasoning_engine_sync.py" + }, { "canonical": true, "clientMethod": { @@ -52522,6 +52675,489 @@ ], "title": "aiplatform_v1beta1_generated_reasoning_engine_execution_service_stream_query_reasoning_engine_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceAsyncClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.delete_reasoning_engine_runtime_revision", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "DeleteReasoningEngineRuntimeRevision" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.DeleteReasoningEngineRuntimeRevisionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_reasoning_engine_runtime_revision" + }, + "description": "Sample for DeleteReasoningEngineRuntimeRevision", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.delete_reasoning_engine_runtime_revision", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.DeleteReasoningEngineRuntimeRevision", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "DeleteReasoningEngineRuntimeRevision" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.DeleteReasoningEngineRuntimeRevisionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_reasoning_engine_runtime_revision" + }, + "description": "Sample for DeleteReasoningEngineRuntimeRevision", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_DeleteReasoningEngineRuntimeRevision_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_delete_reasoning_engine_runtime_revision_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceAsyncClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.get_reasoning_engine_runtime_revision", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "GetReasoningEngineRuntimeRevision" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.GetReasoningEngineRuntimeRevisionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision", + "shortName": "get_reasoning_engine_runtime_revision" + }, + "description": "Sample for GetReasoningEngineRuntimeRevision", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.get_reasoning_engine_runtime_revision", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.GetReasoningEngineRuntimeRevision", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "GetReasoningEngineRuntimeRevision" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.GetReasoningEngineRuntimeRevisionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.types.ReasoningEngineRuntimeRevision", + "shortName": "get_reasoning_engine_runtime_revision" + }, + "description": "Sample for GetReasoningEngineRuntimeRevision", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_GetReasoningEngineRuntimeRevision_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_get_reasoning_engine_runtime_revision_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceAsyncClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceAsyncClient.list_reasoning_engine_runtime_revisions", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "ListReasoningEngineRuntimeRevisions" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.pagers.ListReasoningEngineRuntimeRevisionsAsyncPager", + "shortName": "list_reasoning_engine_runtime_revisions" + }, + "description": "Sample for ListReasoningEngineRuntimeRevisions", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient", + "shortName": "ReasoningEngineRuntimeRevisionServiceClient" + }, + "fullName": "google.cloud.aiplatform_v1beta1.ReasoningEngineRuntimeRevisionServiceClient.list_reasoning_engine_runtime_revisions", + "method": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService.ListReasoningEngineRuntimeRevisions", + "service": { + "fullName": "google.cloud.aiplatform.v1beta1.ReasoningEngineRuntimeRevisionService", + "shortName": "ReasoningEngineRuntimeRevisionService" + }, + "shortName": "ListReasoningEngineRuntimeRevisions" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.aiplatform_v1beta1.types.ListReasoningEngineRuntimeRevisionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.pagers.ListReasoningEngineRuntimeRevisionsPager", + "shortName": "list_reasoning_engine_runtime_revisions" + }, + "description": "Sample for ListReasoningEngineRuntimeRevisions", + "file": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "aiplatform_v1beta1_generated_ReasoningEngineRuntimeRevisionService_ListReasoningEngineRuntimeRevisions_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": "aiplatform_v1beta1_generated_reasoning_engine_runtime_revision_service_list_reasoning_engine_runtime_revisions_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/tests/__init__.py b/tests/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/aiplatform_v1/__init__.py b/tests/unit/gapic/aiplatform_v1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/aiplatform_v1/__init__.py +++ b/tests/unit/gapic/aiplatform_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/aiplatform_v1/test_data_foundry_service.py b/tests/unit/gapic/aiplatform_v1/test_data_foundry_service.py index 89eb9e19f2..429cf00454 100644 --- a/tests/unit/gapic/aiplatform_v1/test_data_foundry_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_data_foundry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -138,6 +133,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert DataFoundryServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -160,6 +156,10 @@ def test__get_default_mtls_endpoint(): DataFoundryServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + DataFoundryServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1740,7 +1740,7 @@ def test_generate_synthetic_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_generate_synthetic_data_rest_unset_required_fields(): @@ -4376,6 +4376,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = DataFoundryServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4515,6 +4547,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = DataFoundryServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4660,6 +4724,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = DataFoundryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4805,6 +4903,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = DataFoundryServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4950,6 +5082,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = DataFoundryServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5095,6 +5261,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = DataFoundryServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5236,6 +5436,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = DataFoundryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5400,6 +5634,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = DataFoundryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5567,6 +5836,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = DataFoundryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5744,6 +6048,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = DataFoundryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = DataFoundryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = DataFoundryServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_dataset_service.py b/tests/unit/gapic/aiplatform_v1/test_dataset_service.py index f45b250cbe..ae0ed41501 100644 --- a/tests/unit/gapic/aiplatform_v1/test_dataset_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_dataset_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -152,6 +147,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert DatasetServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -173,6 +169,10 @@ def test__get_default_mtls_endpoint(): assert ( DatasetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + DatasetServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2907,11 +2907,7 @@ async def test_list_datasets_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_datasets(request={}) - ).pages: + async for page_ in (await client.list_datasets(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5938,11 +5934,7 @@ async def test_list_dataset_versions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_dataset_versions(request={}) - ).pages: + async for page_ in (await client.list_dataset_versions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6808,11 +6800,7 @@ async def test_list_data_items_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_data_items(request={}) - ).pages: + async for page_ in (await client.list_data_items(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7277,11 +7265,7 @@ async def test_search_data_items_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_data_items(request={}) - ).pages: + async for page_ in (await client.search_data_items(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7827,11 +7811,7 @@ async def test_list_saved_queries_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_saved_queries(request={}) - ).pages: + async for page_ in (await client.list_saved_queries(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9048,11 +9028,7 @@ async def test_list_annotations_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_annotations(request={}) - ).pages: + async for page_ in (await client.list_annotations(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9168,7 +9144,7 @@ def test_create_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_dataset_rest_unset_required_fields(): @@ -9355,7 +9331,7 @@ def test_get_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_dataset_rest_unset_required_fields(): @@ -9530,7 +9506,7 @@ def test_update_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_dataset_rest_unset_required_fields(): @@ -9730,7 +9706,7 @@ def test_list_datasets_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_datasets_rest_unset_required_fields(): @@ -9982,7 +9958,7 @@ def test_delete_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_dataset_rest_unset_required_fields(): @@ -10159,7 +10135,7 @@ def test_import_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_data_rest_unset_required_fields(): @@ -10351,7 +10327,7 @@ def test_export_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_data_rest_unset_required_fields(): @@ -10552,7 +10528,7 @@ def test_create_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_dataset_version_rest_unset_required_fields(): @@ -10743,7 +10719,7 @@ def test_update_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_dataset_version_rest_unset_required_fields(): @@ -10941,7 +10917,7 @@ def test_delete_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_dataset_version_rest_unset_required_fields(): @@ -11125,7 +11101,7 @@ def test_get_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_dataset_version_rest_unset_required_fields(): @@ -11320,7 +11296,7 @@ def test_list_dataset_versions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_dataset_versions_rest_unset_required_fields(): @@ -11582,7 +11558,7 @@ def test_restore_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_restore_dataset_version_rest_unset_required_fields(): @@ -11770,7 +11746,7 @@ def test_list_data_items_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_data_items_rest_unset_required_fields(): @@ -12045,7 +12021,7 @@ def test_search_data_items_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_data_items_rest_unset_required_fields(): @@ -12262,7 +12238,7 @@ def test_list_saved_queries_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_saved_queries_rest_unset_required_fields(): @@ -12523,7 +12499,7 @@ def test_delete_saved_query_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_saved_query_rest_unset_required_fields(): @@ -12707,7 +12683,7 @@ def test_get_annotation_spec_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_annotation_spec_rest_unset_required_fields(): @@ -12899,7 +12875,7 @@ def test_list_annotations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_annotations_rest_unset_required_fields(): @@ -23639,6 +23615,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = DatasetServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23778,6 +23786,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = DatasetServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23923,6 +23963,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24068,6 +24142,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = DatasetServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24213,6 +24321,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = DatasetServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24358,6 +24500,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = DatasetServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24499,6 +24675,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24663,6 +24873,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24830,6 +25075,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25007,6 +25287,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py b/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py index 6c2d45eef9..2fa0969774 100644 --- a/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -154,6 +149,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -180,6 +176,10 @@ def test__get_default_mtls_endpoint(): DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2760,9 +2760,7 @@ async def test_list_deployment_resource_pools_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_deployment_resource_pools(request={}) ).pages: pages.append(page_) @@ -4042,11 +4040,7 @@ async def test_query_deployed_models_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.query_deployed_models(request={}) - ).pages: + async for page_ in (await client.query_deployed_models(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4174,7 +4168,7 @@ def test_create_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_deployment_resource_pool_rest_unset_required_fields(): @@ -4376,7 +4370,7 @@ def test_get_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_deployment_resource_pool_rest_unset_required_fields(): @@ -4574,7 +4568,7 @@ def test_list_deployment_resource_pools_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_deployment_resource_pools_rest_unset_required_fields(): @@ -4843,7 +4837,7 @@ def test_update_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_deployment_resource_pool_rest_unset_required_fields(): @@ -5045,7 +5039,7 @@ def test_delete_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_deployment_resource_pool_rest_unset_required_fields(): @@ -5243,7 +5237,7 @@ def test_query_deployed_models_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_deployed_models_rest_unset_required_fields(): @@ -10504,6 +10498,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10643,6 +10669,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10788,6 +10846,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10933,6 +11025,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11078,6 +11204,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11223,6 +11383,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11368,6 +11562,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11532,6 +11760,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11699,6 +11962,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11876,6 +12174,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py b/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py index 285be1034a..4c943430bb 100644 --- a/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -153,6 +148,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert EndpointServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -174,6 +170,10 @@ def test__get_default_mtls_endpoint(): assert ( EndpointServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + EndpointServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2597,11 +2597,7 @@ async def test_list_endpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_endpoints(request={}) - ).pages: + async for page_ in (await client.list_endpoints(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4903,7 +4899,7 @@ def test_create_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_endpoint_rest_unset_required_fields(): @@ -5090,7 +5086,7 @@ def test_get_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_endpoint_rest_unset_required_fields(): @@ -5279,7 +5275,7 @@ def test_list_endpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_endpoints_rest_unset_required_fields(): @@ -5528,7 +5524,7 @@ def test_update_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_endpoint_rest_unset_required_fields(): @@ -5720,7 +5716,7 @@ def test_update_endpoint_long_running_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_endpoint_long_running_rest_unset_required_fields(): @@ -5899,7 +5895,7 @@ def test_delete_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_endpoint_rest_unset_required_fields(): @@ -6078,7 +6074,7 @@ def test_deploy_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_model_rest_unset_required_fields(): @@ -6286,7 +6282,7 @@ def test_undeploy_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_undeploy_model_rest_unset_required_fields(): @@ -6483,7 +6479,7 @@ def test_mutate_deployed_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_mutate_deployed_model_rest_unset_required_fields(): @@ -13351,6 +13347,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = EndpointServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13490,6 +13518,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = EndpointServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13635,6 +13695,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13780,6 +13874,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = EndpointServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13925,6 +14053,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = EndpointServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14070,6 +14232,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = EndpointServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14211,6 +14407,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14375,6 +14605,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14542,6 +14807,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14719,6 +15019,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py b/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py index 3de3ad40fe..b7d74d7291 100644 --- a/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -138,6 +133,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert EvaluationServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -160,6 +156,10 @@ def test__get_default_mtls_endpoint(): EvaluationServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + EvaluationServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1728,7 +1728,7 @@ def test_evaluate_instances_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_evaluate_instances_rest_unset_required_fields(): @@ -4348,6 +4348,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = EvaluationServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4487,6 +4519,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = EvaluationServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4632,6 +4696,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4777,6 +4875,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = EvaluationServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4922,6 +5054,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = EvaluationServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5067,6 +5233,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = EvaluationServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5208,6 +5408,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5372,6 +5606,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5539,6 +5808,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5716,6 +6020,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py index 9d533e4500..5fe4a8f548 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -159,6 +154,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -187,6 +183,10 @@ def test__get_default_mtls_endpoint(): FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2798,11 +2798,7 @@ async def test_list_feature_online_stores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_online_stores(request={}) - ).pages: + async for page_ in (await client.list_feature_online_stores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4849,11 +4845,7 @@ async def test_list_feature_views_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_views(request={}) - ).pages: + async for page_ in (await client.list_feature_views(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6827,11 +6819,7 @@ async def test_list_feature_view_syncs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_view_syncs(request={}) - ).pages: + async for page_ in (await client.list_feature_view_syncs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6970,7 +6958,7 @@ def test_create_feature_online_store_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_online_store_rest_unset_required_fields(): @@ -7176,7 +7164,7 @@ def test_get_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_online_store_rest_unset_required_fields(): @@ -7374,7 +7362,7 @@ def test_list_feature_online_stores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_online_stores_rest_unset_required_fields(): @@ -7640,7 +7628,7 @@ def test_update_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_online_store_rest_unset_required_fields(): @@ -7842,7 +7830,7 @@ def test_delete_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_online_store_rest_unset_required_fields(): @@ -8048,7 +8036,7 @@ def test_create_feature_view_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_view_rest_unset_required_fields(): @@ -8254,7 +8242,7 @@ def test_get_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_view_rest_unset_required_fields(): @@ -8451,7 +8439,7 @@ def test_list_feature_views_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_views_rest_unset_required_fields(): @@ -8712,7 +8700,7 @@ def test_update_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_view_rest_unset_required_fields(): @@ -8907,7 +8895,7 @@ def test_delete_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_view_rest_unset_required_fields(): @@ -9092,7 +9080,7 @@ def test_sync_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_sync_feature_view_rest_unset_required_fields(): @@ -9279,7 +9267,7 @@ def test_get_feature_view_sync_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_view_sync_rest_unset_required_fields(): @@ -9477,7 +9465,7 @@ def test_list_feature_view_syncs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_view_syncs_rest_unset_required_fields(): @@ -18259,6 +18247,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18398,6 +18418,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18543,6 +18595,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18688,6 +18774,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18833,6 +18953,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18978,6 +19132,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19123,6 +19311,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19287,6 +19509,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19454,6 +19711,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19631,6 +19923,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py index 8a284a13cf..a02e907baf 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -139,6 +134,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -163,6 +159,10 @@ def test__get_default_mtls_endpoint(): FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2553,7 +2553,7 @@ def test_fetch_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_fetch_feature_values_rest_unset_required_fields(): @@ -2747,7 +2747,7 @@ def test_search_nearest_entities_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_nearest_entities_rest_unset_required_fields(): @@ -6345,6 +6345,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6484,6 +6516,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6629,6 +6693,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6774,6 +6872,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6919,6 +7051,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7064,6 +7230,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7209,6 +7409,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7373,6 +7607,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7540,6 +7809,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7717,6 +8021,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py index db0ea9b5d5..2d5ba1f6dd 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -150,6 +145,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureRegistryServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -172,6 +168,10 @@ def test__get_default_mtls_endpoint(): FeatureRegistryServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureRegistryServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2685,11 +2685,7 @@ async def test_list_feature_groups_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_groups(request={}) - ).pages: + async for page_ in (await client.list_feature_groups(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4991,11 +4987,7 @@ async def test_list_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_features(request={}) - ).pages: + async for page_ in (await client.list_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5792,7 +5784,7 @@ def test_create_feature_group_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_group_rest_unset_required_fields(): @@ -5991,7 +5983,7 @@ def test_get_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_group_rest_unset_required_fields(): @@ -6186,7 +6178,7 @@ def test_list_feature_groups_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_groups_rest_unset_required_fields(): @@ -6443,7 +6435,7 @@ def test_update_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_group_rest_unset_required_fields(): @@ -6640,7 +6632,7 @@ def test_delete_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_group_rest_unset_required_fields(): @@ -6837,7 +6829,7 @@ def test_create_feature_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_rest_unset_required_fields(): @@ -7035,7 +7027,7 @@ def test_batch_create_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_features_rest_unset_required_fields(): @@ -7223,7 +7215,7 @@ def test_get_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_rest_unset_required_fields(): @@ -7414,7 +7406,7 @@ def test_list_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_features_rest_unset_required_fields(): @@ -7670,7 +7662,7 @@ def test_update_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_rest_unset_required_fields(): @@ -7853,7 +7845,7 @@ def test_delete_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_rest_unset_required_fields(): @@ -15241,6 +15233,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureRegistryServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15380,6 +15404,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureRegistryServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15525,6 +15581,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15670,6 +15760,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15815,6 +15939,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15960,6 +16118,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16105,6 +16297,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16269,6 +16495,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16436,6 +16697,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16613,6 +16909,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py b/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py index 1eb967e2ab..4ff4b9e31b 100644 --- a/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -139,6 +134,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ( FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint(None) is None @@ -169,6 +165,12 @@ def test__get_default_mtls_endpoint(): FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint( + custom_endpoint + ) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2642,7 +2644,7 @@ def test_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_feature_values_rest_unset_required_fields(): @@ -2848,7 +2850,7 @@ def test_streaming_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_streaming_read_feature_values_rest_unset_required_fields(): @@ -3051,7 +3053,7 @@ def test_write_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_feature_values_rest_unset_required_fields(): @@ -6632,6 +6634,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6771,6 +6805,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6916,6 +6982,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7061,6 +7161,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7206,6 +7340,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7351,6 +7519,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7496,6 +7698,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7660,6 +7896,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7827,6 +8098,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8004,6 +8310,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py b/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py index 4ae063ec8b..f8c04c0096 100644 --- a/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -155,6 +150,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeaturestoreServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -177,6 +173,10 @@ def test__get_default_mtls_endpoint(): FeaturestoreServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeaturestoreServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2658,11 +2658,7 @@ async def test_list_featurestores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_featurestores(request={}) - ).pages: + async for page_ in (await client.list_featurestores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4626,11 +4622,7 @@ async def test_list_entity_types_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_entity_types(request={}) - ).pages: + async for page_ in (await client.list_entity_types(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6924,11 +6916,7 @@ async def test_list_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_features(request={}) - ).pages: + async for page_ in (await client.list_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9526,11 +9514,7 @@ async def test_search_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_features(request={}) - ).pages: + async for page_ in (await client.search_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9665,7 +9649,7 @@ def test_create_featurestore_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_featurestore_rest_unset_required_fields(): @@ -9856,7 +9840,7 @@ def test_get_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_featurestore_rest_unset_required_fields(): @@ -10052,7 +10036,7 @@ def test_list_featurestores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_featurestores_rest_unset_required_fields(): @@ -10307,7 +10291,7 @@ def test_update_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_featurestore_rest_unset_required_fields(): @@ -10496,7 +10480,7 @@ def test_delete_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_featurestore_rest_unset_required_fields(): @@ -10697,7 +10681,7 @@ def test_create_entity_type_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_entity_type_rest_unset_required_fields(): @@ -10887,7 +10871,7 @@ def test_get_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_entity_type_rest_unset_required_fields(): @@ -11079,7 +11063,7 @@ def test_list_entity_types_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_entity_types_rest_unset_required_fields(): @@ -11337,7 +11321,7 @@ def test_update_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_entity_type_rest_unset_required_fields(): @@ -11528,7 +11512,7 @@ def test_delete_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_entity_type_rest_unset_required_fields(): @@ -11725,7 +11709,7 @@ def test_create_feature_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_rest_unset_required_fields(): @@ -11923,7 +11907,7 @@ def test_batch_create_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_features_rest_unset_required_fields(): @@ -12111,7 +12095,7 @@ def test_get_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_rest_unset_required_fields(): @@ -12302,7 +12286,7 @@ def test_list_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_features_rest_unset_required_fields(): @@ -12557,7 +12541,7 @@ def test_update_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_rest_unset_required_fields(): @@ -12742,7 +12726,7 @@ def test_delete_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_rest_unset_required_fields(): @@ -12927,7 +12911,7 @@ def test_import_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_feature_values_rest_unset_required_fields(): @@ -13120,7 +13104,7 @@ def test_batch_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_read_feature_values_rest_unset_required_fields(): @@ -13314,7 +13298,7 @@ def test_export_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_feature_values_rest_unset_required_fields(): @@ -13508,7 +13492,7 @@ def test_delete_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_values_rest_unset_required_fields(): @@ -13694,7 +13678,7 @@ def test_search_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_features_rest_unset_required_fields(): @@ -25464,6 +25448,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeaturestoreServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25603,6 +25619,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeaturestoreServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25748,6 +25796,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25893,6 +25975,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26038,6 +26154,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26183,6 +26333,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26326,6 +26510,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26490,6 +26708,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26657,6 +26910,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26834,6 +27122,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_gen_ai_cache_service.py b/tests/unit/gapic/aiplatform_v1/test_gen_ai_cache_service.py index 06afa35eb4..895220489c 100644 --- a/tests/unit/gapic/aiplatform_v1/test_gen_ai_cache_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_gen_ai_cache_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -146,6 +141,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert GenAiCacheServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -168,6 +164,10 @@ def test__get_default_mtls_endpoint(): GenAiCacheServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + GenAiCacheServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3332,11 +3332,7 @@ async def test_list_cached_contents_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_cached_contents(request={}) - ).pages: + async for page_ in (await client.list_cached_contents(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3456,7 +3452,7 @@ def test_create_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_cached_content_rest_unset_required_fields(): @@ -3652,7 +3648,7 @@ def test_get_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_cached_content_rest_unset_required_fields(): @@ -3835,7 +3831,7 @@ def test_update_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_cached_content_rest_unset_required_fields(): @@ -4033,7 +4029,7 @@ def test_delete_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_cached_content_rest_unset_required_fields(): @@ -4224,7 +4220,7 @@ def test_list_cached_contents_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_cached_contents_rest_unset_required_fields(): @@ -4962,6 +4958,10 @@ def test_create_cached_content_rest_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -5512,6 +5512,10 @@ def test_update_cached_content_rest_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -6924,6 +6928,10 @@ async def test_create_cached_content_rest_asyncio_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -7510,6 +7518,10 @@ async def test_update_cached_content_rest_asyncio_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -9665,6 +9677,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = GenAiCacheServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9804,6 +9848,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = GenAiCacheServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9949,6 +10025,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10094,6 +10204,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10239,6 +10383,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10384,6 +10562,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10525,6 +10737,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10689,6 +10935,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10856,6 +11137,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11033,6 +11349,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py b/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py index 3438eb27d7..e8f9647c8e 100644 --- a/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -153,6 +148,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert GenAiTuningServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -175,6 +171,10 @@ def test__get_default_mtls_endpoint(): GenAiTuningServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + GenAiTuningServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2614,11 +2614,7 @@ async def test_list_tuning_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tuning_jobs(request={}) - ).pages: + async for page_ in (await client.list_tuning_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3419,7 +3415,7 @@ def test_create_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tuning_job_rest_unset_required_fields(): @@ -3606,7 +3602,7 @@ def test_get_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tuning_job_rest_unset_required_fields(): @@ -3795,7 +3791,7 @@ def test_list_tuning_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tuning_jobs_rest_unset_required_fields(): @@ -4044,7 +4040,7 @@ def test_cancel_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_tuning_job_rest_unset_required_fields(): @@ -4228,7 +4224,7 @@ def test_rebase_tuned_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_rebase_tuned_model_rest_unset_required_fields(): @@ -9454,6 +9450,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = GenAiTuningServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9593,6 +9621,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = GenAiTuningServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9738,6 +9798,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9883,6 +9977,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10028,6 +10156,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10173,6 +10335,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10314,6 +10510,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10478,6 +10708,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10645,6 +10910,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10822,6 +11122,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py b/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py index 6a288148a6..eb1519285f 100644 --- a/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -150,6 +145,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert IndexEndpointServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -172,6 +168,10 @@ def test__get_default_mtls_endpoint(): IndexEndpointServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + IndexEndpointServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2672,11 +2672,7 @@ async def test_list_index_endpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_index_endpoints(request={}) - ).pages: + async for page_ in (await client.list_index_endpoints(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4564,7 +4560,7 @@ def test_create_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_index_endpoint_rest_unset_required_fields(): @@ -4754,7 +4750,7 @@ def test_get_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_index_endpoint_rest_unset_required_fields(): @@ -4949,7 +4945,7 @@ def test_list_index_endpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_index_endpoints_rest_unset_required_fields(): @@ -5206,7 +5202,7 @@ def test_update_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_index_endpoint_rest_unset_required_fields(): @@ -5404,7 +5400,7 @@ def test_delete_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_index_endpoint_rest_unset_required_fields(): @@ -5584,7 +5580,7 @@ def test_deploy_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_index_rest_unset_required_fields(): @@ -5778,7 +5774,7 @@ def test_undeploy_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_undeploy_index_rest_unset_required_fields(): @@ -5973,7 +5969,7 @@ def test_mutate_deployed_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_mutate_deployed_index_rest_unset_required_fields(): @@ -12509,6 +12505,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = IndexEndpointServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12648,6 +12676,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = IndexEndpointServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12793,6 +12853,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12938,6 +13032,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13083,6 +13211,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13228,6 +13390,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13371,6 +13567,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13535,6 +13765,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13702,6 +13967,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13879,6 +14179,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_index_service.py b/tests/unit/gapic/aiplatform_v1/test_index_service.py index 5b584615ae..18760cf268 100644 --- a/tests/unit/gapic/aiplatform_v1/test_index_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_index_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -144,6 +139,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert IndexServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -162,6 +158,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert IndexServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + IndexServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2503,11 +2503,7 @@ async def test_list_indexes_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_indexes(request={}) - ).pages: + async for page_ in (await client.list_indexes(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3777,7 +3773,7 @@ def test_create_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_index_rest_unset_required_fields(): @@ -3960,7 +3956,7 @@ def test_get_index_rest_required_fields(request_type=index_service.GetIndexReque expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_index_rest_unset_required_fields(): @@ -4146,7 +4142,7 @@ def test_list_indexes_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_indexes_rest_unset_required_fields(): @@ -4393,7 +4389,7 @@ def test_update_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_index_rest_unset_required_fields(): @@ -4574,7 +4570,7 @@ def test_delete_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_index_rest_unset_required_fields(): @@ -4752,7 +4748,7 @@ def test_upsert_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upsert_datapoints_rest_unset_required_fields(): @@ -4875,7 +4871,7 @@ def test_remove_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_remove_datapoints_rest_unset_required_fields(): @@ -10230,6 +10226,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = IndexServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10369,6 +10397,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = IndexServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10514,6 +10574,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10659,6 +10753,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = IndexServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10804,6 +10932,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = IndexServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10949,6 +11111,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = IndexServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11090,6 +11286,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11254,6 +11484,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11421,6 +11686,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11598,6 +11898,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_job_service.py b/tests/unit/gapic/aiplatform_v1/test_job_service.py index 149b316088..7b0ad8ca04 100644 --- a/tests/unit/gapic/aiplatform_v1/test_job_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_job_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -179,6 +174,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert JobServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -197,6 +193,9 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + JobServiceClient._get_default_mtls_endpoint(custom_endpoint) == custom_endpoint + ) def test__read_environment_variables(): @@ -2547,11 +2546,7 @@ async def test_list_custom_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_custom_jobs(request={}) - ).pages: + async for page_ in (await client.list_custom_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4527,11 +4522,7 @@ async def test_list_data_labeling_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_data_labeling_jobs(request={}) - ).pages: + async for page_ in (await client.list_data_labeling_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6526,9 +6517,7 @@ async def test_list_hyperparameter_tuning_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_hyperparameter_tuning_jobs(request={}) ).pages: pages.append(page_) @@ -8413,11 +8402,7 @@ async def test_list_nas_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_nas_jobs(request={}) - ).pages: + async for page_ in (await client.list_nas_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9942,11 +9927,7 @@ async def test_list_nas_trial_details_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_nas_trial_details(request={}) - ).pages: + async for page_ in (await client.list_nas_trial_details(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -11273,11 +11254,7 @@ async def test_list_batch_prediction_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_batch_prediction_jobs(request={}) - ).pages: + async for page_ in (await client.list_batch_prediction_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -12978,9 +12955,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.search_model_deployment_monitoring_stats_anomalies(request={}) ).pages: pages.append(page_) @@ -13930,9 +13905,7 @@ async def test_list_model_deployment_monitoring_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_deployment_monitoring_jobs(request={}) ).pages: pages.append(page_) @@ -15425,7 +15398,7 @@ def test_create_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_custom_job_rest_unset_required_fields(): @@ -15612,7 +15585,7 @@ def test_get_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_custom_job_rest_unset_required_fields(): @@ -15802,7 +15775,7 @@ def test_list_custom_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_custom_jobs_rest_unset_required_fields(): @@ -16055,7 +16028,7 @@ def test_delete_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_custom_job_rest_unset_required_fields(): @@ -16232,7 +16205,7 @@ def test_cancel_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_custom_job_rest_unset_required_fields(): @@ -16416,7 +16389,7 @@ def test_create_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_data_labeling_job_rest_unset_required_fields(): @@ -16609,7 +16582,7 @@ def test_get_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_data_labeling_job_rest_unset_required_fields(): @@ -16804,7 +16777,7 @@ def test_list_data_labeling_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_data_labeling_jobs_rest_unset_required_fields(): @@ -17062,7 +17035,7 @@ def test_delete_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_data_labeling_job_rest_unset_required_fields(): @@ -17243,7 +17216,7 @@ def test_cancel_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_data_labeling_job_rest_unset_required_fields(): @@ -17429,7 +17402,7 @@ def test_create_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -17632,7 +17605,7 @@ def test_get_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -17832,7 +17805,7 @@ def test_list_hyperparameter_tuning_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_hyperparameter_tuning_jobs_rest_unset_required_fields(): @@ -18097,7 +18070,7 @@ def test_delete_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -18280,7 +18253,7 @@ def test_cancel_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -18461,7 +18434,7 @@ def test_create_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_nas_job_rest_unset_required_fields(): @@ -18646,7 +18619,7 @@ def test_get_nas_job_rest_required_fields(request_type=job_service.GetNasJobRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_nas_job_rest_unset_required_fields(): @@ -18832,7 +18805,7 @@ def test_list_nas_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_nas_jobs_rest_unset_required_fields(): @@ -19081,7 +19054,7 @@ def test_delete_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_nas_job_rest_unset_required_fields(): @@ -19254,7 +19227,7 @@ def test_cancel_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_nas_job_rest_unset_required_fields(): @@ -19434,7 +19407,7 @@ def test_get_nas_trial_detail_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_nas_trial_detail_rest_unset_required_fields(): @@ -19626,7 +19599,7 @@ def test_list_nas_trial_details_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_nas_trial_details_rest_unset_required_fields(): @@ -19885,7 +19858,7 @@ def test_create_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_batch_prediction_job_rest_unset_required_fields(): @@ -20082,7 +20055,7 @@ def test_get_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_batch_prediction_job_rest_unset_required_fields(): @@ -20276,7 +20249,7 @@ def test_list_batch_prediction_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_batch_prediction_jobs_rest_unset_required_fields(): @@ -20535,7 +20508,7 @@ def test_delete_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_batch_prediction_job_rest_unset_required_fields(): @@ -20716,7 +20689,7 @@ def test_cancel_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_batch_prediction_job_rest_unset_required_fields(): @@ -20908,7 +20881,7 @@ def test_create_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -21135,7 +21108,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_required_fields expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_model_deployment_monitoring_stats_anomalies_rest_unset_required_fields(): @@ -21424,7 +21397,7 @@ def test_get_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -21630,7 +21603,7 @@ def test_list_model_deployment_monitoring_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_deployment_monitoring_jobs_rest_unset_required_fields(): @@ -21901,7 +21874,7 @@ def test_update_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22109,7 +22082,7 @@ def test_delete_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22298,7 +22271,7 @@ def test_pause_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_pause_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22487,7 +22460,7 @@ def test_resume_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_resume_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -41741,6 +41714,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = JobServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41880,6 +41885,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = JobServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42025,6 +42062,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42170,6 +42241,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = JobServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42315,6 +42420,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = JobServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42460,6 +42599,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = JobServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42601,6 +42774,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42765,6 +42972,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42932,6 +43174,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43109,6 +43386,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py b/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py index 984aa91e93..ba1e169367 100644 --- a/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -140,6 +135,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert LlmUtilityServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -162,6 +158,10 @@ def test__get_default_mtls_endpoint(): LlmUtilityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + LlmUtilityServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2145,7 +2145,7 @@ def test_count_tokens_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_count_tokens_rest_unset_required_fields(): @@ -2328,7 +2328,7 @@ def test_compute_tokens_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_compute_tokens_rest_unset_required_fields(): @@ -5440,6 +5440,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = LlmUtilityServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5579,6 +5611,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = LlmUtilityServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5724,6 +5788,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5869,6 +5967,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6014,6 +6146,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6159,6 +6325,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6300,6 +6500,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6464,6 +6698,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6631,6 +6900,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6808,6 +7112,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_match_service.py b/tests/unit/gapic/aiplatform_v1/test_match_service.py index 1966edda66..cd9d35af6e 100644 --- a/tests/unit/gapic/aiplatform_v1/test_match_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_match_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -132,6 +127,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MatchServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -150,6 +146,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert MatchServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + MatchServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1897,7 +1897,7 @@ def test_find_neighbors_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_find_neighbors_rest_unset_required_fields(): @@ -2023,7 +2023,7 @@ def test_read_index_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_index_datapoints_rest_unset_required_fields(): @@ -5041,6 +5041,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MatchServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5180,6 +5212,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MatchServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5325,6 +5389,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5470,6 +5568,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MatchServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5615,6 +5747,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MatchServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5760,6 +5926,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MatchServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5901,6 +6101,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6065,6 +6299,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6232,6 +6501,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6409,6 +6713,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_metadata_service.py b/tests/unit/gapic/aiplatform_v1/test_metadata_service.py index eb69de8b6a..863f7c224d 100644 --- a/tests/unit/gapic/aiplatform_v1/test_metadata_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_metadata_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -155,6 +150,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MetadataServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -176,6 +172,10 @@ def test__get_default_mtls_endpoint(): assert ( MetadataServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + MetadataServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2619,11 +2619,7 @@ async def test_list_metadata_stores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_metadata_stores(request={}) - ).pages: + async for page_ in (await client.list_metadata_stores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4209,11 +4205,7 @@ async def test_list_artifacts_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_artifacts(request={}) - ).pages: + async for page_ in (await client.list_artifacts(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6455,11 +6447,7 @@ async def test_list_contexts_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_contexts(request={}) - ).pages: + async for page_ in (await client.list_contexts(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -10091,11 +10079,7 @@ async def test_list_executions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_executions(request={}) - ).pages: + async for page_ in (await client.list_executions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -13094,11 +13078,7 @@ async def test_list_metadata_schemas_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_metadata_schemas(request={}) - ).pages: + async for page_ in (await client.list_metadata_schemas(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -13560,7 +13540,7 @@ def test_create_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_metadata_store_rest_unset_required_fields(): @@ -13752,7 +13732,7 @@ def test_get_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_metadata_store_rest_unset_required_fields(): @@ -13943,7 +13923,7 @@ def test_list_metadata_stores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_metadata_stores_rest_unset_required_fields(): @@ -14200,7 +14180,7 @@ def test_delete_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_metadata_store_rest_unset_required_fields(): @@ -14381,7 +14361,7 @@ def test_create_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_artifact_rest_unset_required_fields(): @@ -14573,7 +14553,7 @@ def test_get_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_artifact_rest_unset_required_fields(): @@ -14762,7 +14742,7 @@ def test_list_artifacts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_artifacts_rest_unset_required_fields(): @@ -15020,7 +15000,7 @@ def test_update_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_artifact_rest_unset_required_fields(): @@ -15215,7 +15195,7 @@ def test_delete_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_artifact_rest_unset_required_fields(): @@ -15399,7 +15379,7 @@ def test_purge_artifacts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_artifacts_rest_unset_required_fields(): @@ -15588,7 +15568,7 @@ def test_create_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_context_rest_unset_required_fields(): @@ -15780,7 +15760,7 @@ def test_get_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_context_rest_unset_required_fields(): @@ -15969,7 +15949,7 @@ def test_list_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_contexts_rest_unset_required_fields(): @@ -16227,7 +16207,7 @@ def test_update_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_context_rest_unset_required_fields(): @@ -16427,7 +16407,7 @@ def test_delete_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_context_rest_unset_required_fields(): @@ -16619,7 +16599,7 @@ def test_purge_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_contexts_rest_unset_required_fields(): @@ -16813,7 +16793,7 @@ def test_add_context_artifacts_and_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_context_artifacts_and_executions_rest_unset_required_fields(): @@ -17008,7 +16988,7 @@ def test_add_context_children_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_context_children_rest_unset_required_fields(): @@ -17198,7 +17178,7 @@ def test_remove_context_children_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_remove_context_children_rest_unset_required_fields(): @@ -17385,7 +17365,7 @@ def test_query_context_lineage_subgraph_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_context_lineage_subgraph_rest_unset_required_fields(): @@ -17572,7 +17552,7 @@ def test_create_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_execution_rest_unset_required_fields(): @@ -17764,7 +17744,7 @@ def test_get_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_execution_rest_unset_required_fields(): @@ -17953,7 +17933,7 @@ def test_list_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_executions_rest_unset_required_fields(): @@ -18213,7 +18193,7 @@ def test_update_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_execution_rest_unset_required_fields(): @@ -18410,7 +18390,7 @@ def test_delete_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_execution_rest_unset_required_fields(): @@ -18596,7 +18576,7 @@ def test_purge_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_executions_rest_unset_required_fields(): @@ -18787,7 +18767,7 @@ def test_add_execution_events_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_execution_events_rest_unset_required_fields(): @@ -18974,7 +18954,7 @@ def test_query_execution_inputs_and_outputs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_execution_inputs_and_outputs_rest_unset_required_fields(): @@ -19166,7 +19146,7 @@ def test_create_metadata_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_metadata_schema_rest_unset_required_fields(): @@ -19362,7 +19342,7 @@ def test_get_metadata_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_metadata_schema_rest_unset_required_fields(): @@ -19555,7 +19535,7 @@ def test_list_metadata_schemas_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_metadata_schemas_rest_unset_required_fields(): @@ -19821,7 +19801,7 @@ def test_query_artifact_lineage_subgraph_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_artifact_lineage_subgraph_rest_unset_required_fields(): @@ -36201,6 +36181,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MetadataServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36340,6 +36352,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MetadataServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36485,6 +36529,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36630,6 +36708,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MetadataServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36775,6 +36887,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MetadataServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36920,6 +37066,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MetadataServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37061,6 +37241,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37225,6 +37439,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37392,6 +37641,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37569,6 +37853,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_migration_service.py b/tests/unit/gapic/aiplatform_v1/test_migration_service.py index 1aa93934c0..f4c88341a5 100644 --- a/tests/unit/gapic/aiplatform_v1/test_migration_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_migration_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -138,6 +133,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MigrationServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -160,6 +156,10 @@ def test__get_default_mtls_endpoint(): MigrationServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + MigrationServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1902,11 +1902,7 @@ async def test_search_migratable_resources_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_migratable_resources(request={}) - ).pages: + async for page_ in (await client.search_migratable_resources(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2421,7 +2417,7 @@ def test_search_migratable_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_migratable_resources_rest_unset_required_fields(): @@ -2674,7 +2670,7 @@ def test_batch_migrate_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_migrate_resources_rest_unset_required_fields(): @@ -5595,7 +5591,7 @@ def test_parse_annotated_dataset_path(): assert expected == actual -def test_dataset_path(): +def test_auto_ml_dataset_path(): project = "cuttlefish" location = "mussel" dataset = "winkle" @@ -5604,95 +5600,95 @@ def test_dataset_path(): location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.auto_ml_dataset_path(project, location, dataset) assert expected == actual -def test_parse_dataset_path(): +def test_parse_auto_ml_dataset_path(): expected = { "project": "nautilus", "location": "scallop", "dataset": "abalone", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.auto_ml_dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_auto_ml_dataset_path(path) assert expected == actual -def test_dataset_path(): +def test_auto_ml_model_path(): project = "squid" - dataset = "clam" - expected = "projects/{project}/datasets/{dataset}".format( + location = "clam" + model = "whelk" + expected = "projects/{project}/locations/{location}/models/{model}".format( project=project, - dataset=dataset, + location=location, + model=model, ) - actual = MigrationServiceClient.dataset_path(project, dataset) + actual = MigrationServiceClient.auto_ml_model_path(project, location, model) assert expected == actual -def test_parse_dataset_path(): +def test_parse_auto_ml_model_path(): expected = { - "project": "whelk", - "dataset": "octopus", + "project": "octopus", + "location": "oyster", + "model": "nudibranch", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.auto_ml_model_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_auto_ml_model_path(path) assert expected == actual -def test_dataset_path(): - project = "oyster" - location = "nudibranch" - dataset = "cuttlefish" - expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( +def test_data_labeling_dataset_path(): + project = "cuttlefish" + dataset = "mussel" + expected = "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.data_labeling_dataset_path(project, dataset) assert expected == actual -def test_parse_dataset_path(): +def test_parse_data_labeling_dataset_path(): expected = { - "project": "mussel", - "location": "winkle", + "project": "winkle", "dataset": "nautilus", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.data_labeling_dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_data_labeling_dataset_path(path) assert expected == actual -def test_model_path(): +def test_dataset_path(): project = "scallop" location = "abalone" - model = "squid" - expected = "projects/{project}/locations/{location}/models/{model}".format( + dataset = "squid" + expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, location=location, - model=model, + dataset=dataset, ) - actual = MigrationServiceClient.model_path(project, location, model) + actual = MigrationServiceClient.dataset_path(project, location, dataset) assert expected == actual -def test_parse_model_path(): +def test_parse_dataset_path(): expected = { "project": "clam", "location": "whelk", - "model": "octopus", + "dataset": "octopus", } - path = MigrationServiceClient.model_path(**expected) + path = MigrationServiceClient.dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_model_path(path) + actual = MigrationServiceClient.parse_dataset_path(path) assert expected == actual @@ -6013,6 +6009,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MigrationServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6152,6 +6180,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MigrationServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6297,6 +6357,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6442,6 +6536,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MigrationServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6587,6 +6715,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MigrationServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6732,6 +6894,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MigrationServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6873,6 +7069,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7037,6 +7267,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7204,6 +7469,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7381,6 +7681,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py b/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py index 36814aa031..ef7751e34d 100644 --- a/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -145,6 +140,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ModelGardenServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -167,6 +163,10 @@ def test__get_default_mtls_endpoint(): ModelGardenServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ModelGardenServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2130,7 +2130,7 @@ def test_get_publisher_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_publisher_model_rest_unset_required_fields(): @@ -2316,7 +2316,7 @@ def test_deploy_rest_required_fields(request_type=model_garden_service.DeployReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_rest_unset_required_fields(): @@ -5523,6 +5523,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ModelGardenServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5662,6 +5694,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ModelGardenServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5807,6 +5871,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5952,6 +6050,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ModelGardenServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6097,6 +6229,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ModelGardenServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6242,6 +6408,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ModelGardenServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6383,6 +6583,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6547,6 +6781,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6714,6 +6983,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6891,6 +7195,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_model_service.py b/tests/unit/gapic/aiplatform_v1/test_model_service.py index 2a1afa47e5..d7d6c85b75 100644 --- a/tests/unit/gapic/aiplatform_v1/test_model_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_model_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -154,6 +149,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ModelServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -172,6 +168,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert ModelServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + ModelServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2581,11 +2581,7 @@ async def test_list_models_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_models(request={}) - ).pages: + async for page_ in (await client.list_models(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3130,11 +3126,7 @@ async def test_list_model_versions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_versions(request={}) - ).pages: + async for page_ in (await client.list_model_versions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3681,9 +3673,7 @@ async def test_list_model_version_checkpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_version_checkpoints(request={}) ).pages: pages.append(page_) @@ -8271,11 +8261,7 @@ async def test_list_model_evaluations_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_evaluations(request={}) - ).pages: + async for page_ in (await client.list_model_evaluations(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9174,9 +9160,7 @@ async def test_list_model_evaluation_slices_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_evaluation_slices(request={}) ).pages: pages.append(page_) @@ -9294,7 +9278,7 @@ def test_upload_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upload_model_rest_unset_required_fields(): @@ -9478,7 +9462,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_rest_unset_required_fields(): @@ -9663,7 +9647,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_models_rest_unset_required_fields(): @@ -9926,7 +9910,7 @@ def test_list_model_versions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_versions_rest_unset_required_fields(): @@ -10192,7 +10176,7 @@ def test_list_model_version_checkpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_version_checkpoints_rest_unset_required_fields(): @@ -10446,7 +10430,7 @@ def test_update_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_model_rest_unset_required_fields(): @@ -10643,7 +10627,7 @@ def test_update_explanation_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_explanation_dataset_rest_unset_required_fields(): @@ -10820,7 +10804,7 @@ def test_delete_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_rest_unset_required_fields(): @@ -11000,7 +10984,7 @@ def test_delete_model_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_version_rest_unset_required_fields(): @@ -11186,7 +11170,7 @@ def test_merge_version_aliases_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_merge_version_aliases_rest_unset_required_fields(): @@ -11376,7 +11360,7 @@ def test_export_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_model_rest_unset_required_fields(): @@ -11570,7 +11554,7 @@ def test_copy_model_rest_required_fields(request_type=model_service.CopyModelReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_copy_model_rest_unset_required_fields(): @@ -11762,7 +11746,7 @@ def test_import_model_evaluation_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_model_evaluation_rest_unset_required_fields(): @@ -11958,7 +11942,7 @@ def test_batch_import_model_evaluation_slices_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_import_model_evaluation_slices_rest_unset_required_fields(): @@ -12166,7 +12150,7 @@ def test_batch_import_evaluated_annotations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_import_evaluated_annotations_rest_unset_required_fields(): @@ -12374,7 +12358,7 @@ def test_get_model_evaluation_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_evaluation_rest_unset_required_fields(): @@ -12568,7 +12552,7 @@ def test_list_model_evaluations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_evaluations_rest_unset_required_fields(): @@ -12824,7 +12808,7 @@ def test_get_model_evaluation_slice_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_evaluation_slice_rest_unset_required_fields(): @@ -13020,7 +13004,7 @@ def test_list_model_evaluation_slices_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_evaluation_slices_rest_unset_required_fields(): @@ -23614,6 +23598,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ModelServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23753,6 +23769,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ModelServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23898,6 +23946,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24043,6 +24125,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ModelServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24188,6 +24304,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ModelServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24333,6 +24483,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ModelServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24474,6 +24658,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24638,6 +24856,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24805,6 +25058,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24982,6 +25270,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_notebook_service.py b/tests/unit/gapic/aiplatform_v1/test_notebook_service.py index 2d93116e06..82755879cb 100644 --- a/tests/unit/gapic/aiplatform_v1/test_notebook_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_notebook_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -161,6 +156,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert NotebookServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -182,6 +178,10 @@ def test__get_default_mtls_endpoint(): assert ( NotebookServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + NotebookServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2675,9 +2675,7 @@ async def test_list_notebook_runtime_templates_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_notebook_runtime_templates(request={}) ).pages: pages.append(page_) @@ -4749,11 +4747,7 @@ async def test_list_notebook_runtimes_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_notebook_runtimes(request={}) - ).pages: + async for page_ in (await client.list_notebook_runtimes(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7450,9 +7444,7 @@ async def test_list_notebook_execution_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_notebook_execution_jobs(request={}) ).pages: pages.append(page_) @@ -7924,7 +7916,7 @@ def test_create_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_notebook_runtime_template_rest_unset_required_fields(): @@ -8123,7 +8115,7 @@ def test_get_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_runtime_template_rest_unset_required_fields(): @@ -8322,7 +8314,7 @@ def test_list_notebook_runtime_templates_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_runtime_templates_rest_unset_required_fields(): @@ -8589,7 +8581,7 @@ def test_delete_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_runtime_template_rest_unset_required_fields(): @@ -8772,7 +8764,7 @@ def test_update_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_notebook_runtime_template_rest_unset_required_fields(): @@ -8984,7 +8976,7 @@ def test_assign_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_assign_notebook_runtime_rest_unset_required_fields(): @@ -9179,7 +9171,7 @@ def test_get_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_runtime_rest_unset_required_fields(): @@ -9376,7 +9368,7 @@ def test_list_notebook_runtimes_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_runtimes_rest_unset_required_fields(): @@ -9634,7 +9626,7 @@ def test_delete_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_runtime_rest_unset_required_fields(): @@ -9819,7 +9811,7 @@ def test_upgrade_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upgrade_notebook_runtime_rest_unset_required_fields(): @@ -10004,7 +9996,7 @@ def test_start_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_start_notebook_runtime_rest_unset_required_fields(): @@ -10189,7 +10181,7 @@ def test_stop_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stop_notebook_runtime_rest_unset_required_fields(): @@ -10376,7 +10368,7 @@ def test_create_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_notebook_execution_job_rest_unset_required_fields(): @@ -10581,7 +10573,7 @@ def test_get_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_execution_job_rest_unset_required_fields(): @@ -10778,7 +10770,7 @@ def test_list_notebook_execution_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_execution_jobs_rest_unset_required_fields(): @@ -11041,7 +11033,7 @@ def test_delete_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_execution_job_rest_unset_required_fields(): @@ -20717,6 +20709,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = NotebookServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20856,6 +20880,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = NotebookServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21001,6 +21057,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21146,6 +21236,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = NotebookServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21291,6 +21415,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = NotebookServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21436,6 +21594,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = NotebookServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21577,6 +21769,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21741,6 +21967,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21908,6 +22169,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22085,6 +22381,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py b/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py index b008bd26ad..3b3bb86df0 100644 --- a/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -154,6 +149,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PersistentResourceServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -178,6 +174,10 @@ def test__get_default_mtls_endpoint(): PersistentResourceServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PersistentResourceServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2707,11 +2707,7 @@ async def test_list_persistent_resources_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_persistent_resources(request={}) - ).pages: + async for page_ in (await client.list_persistent_resources(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3905,7 +3901,7 @@ def test_create_persistent_resource_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_persistent_resource_rest_unset_required_fields(): @@ -4103,7 +4099,7 @@ def test_get_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_persistent_resource_rest_unset_required_fields(): @@ -4299,7 +4295,7 @@ def test_list_persistent_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_persistent_resources_rest_unset_required_fields(): @@ -4559,7 +4555,7 @@ def test_delete_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_persistent_resource_rest_unset_required_fields(): @@ -4741,7 +4737,7 @@ def test_update_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_persistent_resource_rest_unset_required_fields(): @@ -4942,7 +4938,7 @@ def test_reboot_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_reboot_persistent_resource_rest_unset_required_fields(): @@ -10381,6 +10377,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PersistentResourceServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10520,6 +10548,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PersistentResourceServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10665,6 +10725,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10810,6 +10904,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10955,6 +11083,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11100,6 +11262,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11245,6 +11441,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11409,6 +11639,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11576,6 +11841,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11753,6 +12053,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py b/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py index 9aa35a7512..8b0bd69af4 100644 --- a/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -163,6 +158,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PipelineServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -184,6 +180,10 @@ def test__get_default_mtls_endpoint(): assert ( PipelineServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PipelineServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2651,11 +2651,7 @@ async def test_list_training_pipelines_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_training_pipelines(request={}) - ).pages: + async for page_ in (await client.list_training_pipelines(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4632,11 +4628,7 @@ async def test_list_pipeline_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_pipeline_jobs(request={}) - ).pages: + async for page_ in (await client.list_pipeline_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6146,7 +6138,7 @@ def test_create_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_training_pipeline_rest_unset_required_fields(): @@ -6339,7 +6331,7 @@ def test_get_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_training_pipeline_rest_unset_required_fields(): @@ -6535,7 +6527,7 @@ def test_list_training_pipelines_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_training_pipelines_rest_unset_required_fields(): @@ -6792,7 +6784,7 @@ def test_delete_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_training_pipeline_rest_unset_required_fields(): @@ -6973,7 +6965,7 @@ def test_cancel_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_training_pipeline_rest_unset_required_fields(): @@ -7158,7 +7150,7 @@ def test_create_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_pipeline_job_rest_unset_required_fields(): @@ -7350,7 +7342,7 @@ def test_get_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_pipeline_job_rest_unset_required_fields(): @@ -7544,7 +7536,7 @@ def test_list_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_pipeline_jobs_rest_unset_required_fields(): @@ -7801,7 +7793,7 @@ def test_delete_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_pipeline_job_rest_unset_required_fields(): @@ -7990,7 +7982,7 @@ def test_batch_delete_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_delete_pipeline_jobs_rest_unset_required_fields(): @@ -8178,7 +8170,7 @@ def test_cancel_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_pipeline_job_rest_unset_required_fields(): @@ -8367,7 +8359,7 @@ def test_batch_cancel_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_cancel_pipeline_jobs_rest_unset_required_fields(): @@ -16546,6 +16538,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PipelineServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16685,6 +16709,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PipelineServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16830,6 +16886,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16975,6 +17065,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PipelineServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17120,6 +17244,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PipelineServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17265,6 +17423,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PipelineServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17406,6 +17598,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17570,6 +17796,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17737,6 +17998,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17914,6 +18210,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py index fa2877f0c6..89990133d6 100644 --- a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -148,6 +143,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PredictionServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -170,6 +166,10 @@ def test__get_default_mtls_endpoint(): PredictionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PredictionServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -5136,7 +5136,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_predict_rest_unset_required_fields(): @@ -5327,7 +5327,7 @@ def test_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_raw_predict_rest_unset_required_fields(): @@ -5513,7 +5513,7 @@ def test_stream_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_raw_predict_rest_unset_required_fields(): @@ -5697,7 +5697,7 @@ def test_direct_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_direct_predict_rest_unset_required_fields(): @@ -5822,7 +5822,7 @@ def test_direct_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_direct_raw_predict_rest_unset_required_fields(): @@ -5984,7 +5984,7 @@ def test_server_streaming_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_server_streaming_predict_rest_unset_required_fields(): @@ -6114,7 +6114,7 @@ def test_explain_rest_required_fields(request_type=prediction_service.ExplainReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_explain_rest_unset_required_fields(): @@ -6311,7 +6311,7 @@ def test_generate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_generate_content_rest_unset_required_fields(): @@ -6510,7 +6510,7 @@ def test_stream_generate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_generate_content_rest_unset_required_fields(): @@ -13084,6 +13084,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PredictionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13223,6 +13255,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PredictionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13368,6 +13432,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13513,6 +13611,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PredictionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13658,6 +13790,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PredictionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13803,6 +13969,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PredictionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13944,6 +14144,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14108,6 +14342,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14275,6 +14544,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14452,6 +14756,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_execution_service.py b/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_execution_service.py index 2aee96606c..d53b01afe2 100644 --- a/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_execution_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -143,6 +138,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ( ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint(None) is None @@ -173,6 +169,12 @@ def test__get_default_mtls_endpoint(): ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint( + custom_endpoint + ) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2249,6 +2251,279 @@ async def test_async_query_reasoning_engine_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +def test_cancel_async_query_reasoning_engine(request_type, transport: str = "grpc"): + client = ReasoningEngineExecutionServiceClient( + 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.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + response = client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +def test_cancel_async_query_reasoning_engine_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client.cancel_async_query_reasoning_engine(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[ + 0 + ] == reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + +def test_cancel_async_query_reasoning_engine_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.cancel_async_query_reasoning_engine + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + request = {} + client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async_use_cached_wrapped_rpc( + transport: str = "grpc_asyncio", +): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._client._transport.cancel_async_query_reasoning_engine + in client._client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[ + client._client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + + request = {} + await client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async( + transport: str = "grpc_asyncio", + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + response = await client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async_from_dict(): + await test_cancel_async_query_reasoning_engine_async(request_type=dict) + + +def test_cancel_async_query_reasoning_engine_field_headers(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + client.cancel_async_query_reasoning_engine(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_cancel_async_query_reasoning_engine_field_headers_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + await client.cancel_async_query_reasoning_engine(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_query_reasoning_engine_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2367,7 +2642,7 @@ def test_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_reasoning_engine_rest_unset_required_fields(): @@ -2494,7 +2769,7 @@ def test_stream_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_query_reasoning_engine_rest_unset_required_fields(): @@ -2623,7 +2898,7 @@ def test_async_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_async_query_reasoning_engine_rest_unset_required_fields(): @@ -2635,29 +2910,173 @@ def test_async_query_reasoning_engine_rest_unset_required_fields(): assert set(unset_fields) == (set(()) & set(("name",))) -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): +def test_cancel_async_query_reasoning_engine_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + transport="rest", ) - # It is an error to provide a credentials file and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ReasoningEngineExecutionServiceClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() - # It is an error to provide an api_key and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + # Ensure method has been cached + assert ( + client._transport.cancel_async_query_reasoning_engine + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + + request = {} + client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_cancel_async_query_reasoning_engine_rest_required_fields( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + transport_class = transports.ReasoningEngineExecutionServiceRestTransport + + request_init = {} + request_init["name"] = "" + request_init["operation_name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson(pb_request, use_integers_for_enums=False) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).cancel_async_query_reasoning_engine._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + jsonified_request["operationName"] = "operation_name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).cancel_async_query_reasoning_engine._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + assert "operationName" in jsonified_request + assert jsonified_request["operationName"] == "operation_name_value" + + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.cancel_async_query_reasoning_engine(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert sorted(expected_params) == sorted(actual_params) + + +def test_cancel_async_query_reasoning_engine_rest_unset_required_fields(): + transport = transports.ReasoningEngineExecutionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = ( + transport.cancel_async_query_reasoning_engine._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "name", + "operationName", + ) + ) + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineExecutionServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() @@ -2816,6 +3235,33 @@ def test_async_query_reasoning_engine_empty_call_grpc(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_async_query_reasoning_engine_empty_call_grpc(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_transport_kind_grpc_asyncio(): transport = ReasoningEngineExecutionServiceAsyncClient.get_transport_class( "grpc_asyncio" @@ -2914,6 +3360,35 @@ async def test_async_query_reasoning_engine_empty_call_grpc_asyncio(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_empty_call_grpc_asyncio(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + await client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_transport_kind_rest(): transport = ReasoningEngineExecutionServiceClient.get_transport_class("rest")( credentials=ga_credentials.AnonymousCredentials() @@ -3328,10 +3803,159 @@ def test_async_query_reasoning_engine_rest_interceptors(null_interceptor): ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - post_with_metadata.return_value = operations_pb2.Operation(), metadata + post.return_value = operations_pb2.Operation() + post_with_metadata.return_value = operations_pb2.Operation(), metadata + + client.async_query_reasoning_engine( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +def test_cancel_async_query_reasoning_engine_rest_bad_request( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.cancel_async_query_reasoning_engine(request) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +def test_cancel_async_query_reasoning_engine_rest_call_success(request_type): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.cancel_async_query_reasoning_engine(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_cancel_async_query_reasoning_engine_rest_interceptors(null_interceptor): + transport = transports.ReasoningEngineExecutionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=( + None + if null_interceptor + else transports.ReasoningEngineExecutionServiceRestInterceptor() + ), + ) + client = ReasoningEngineExecutionServiceClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine", + ) as post, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "pre_cancel_async_query_reasoning_engine", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + req.return_value.content = return_value + + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse(), + metadata, + ) - client.async_query_reasoning_engine( + client.cancel_async_query_reasoning_engine( request, metadata=[ ("key", "val"), @@ -4046,6 +4670,30 @@ def test_async_query_reasoning_engine_empty_call_rest(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_async_query_reasoning_engine_empty_call_rest(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_reasoning_engine_execution_service_rest_lro_client(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4545,6 +5193,175 @@ async def test_async_query_reasoning_engine_rest_asyncio_interceptors(null_inter post_with_metadata.assert_called_once() +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_rest_asyncio_bad_request( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.cancel_async_query_reasoning_engine(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +async def test_cancel_async_query_reasoning_engine_rest_asyncio_call_success( + request_type, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = await client.cancel_async_query_reasoning_engine(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("null_interceptor", [True, False]) +async def test_cancel_async_query_reasoning_engine_rest_asyncio_interceptors( + null_interceptor, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = transports.AsyncReasoningEngineExecutionServiceRestTransport( + credentials=async_anonymous_credentials(), + interceptor=( + None + if null_interceptor + else transports.AsyncReasoningEngineExecutionServiceRestInterceptor() + ), + ) + client = ReasoningEngineExecutionServiceAsyncClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine", + ) as post, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "pre_cancel_async_query_reasoning_engine", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + req.return_value.read = mock.AsyncMock(return_value=return_value) + + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse(), + metadata, + ) + + await client.cancel_async_query_reasoning_engine( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + @pytest.mark.asyncio async def test_get_location_rest_asyncio_bad_request( request_type=locations_pb2.GetLocationRequest, @@ -5378,6 +6195,35 @@ async def test_async_query_reasoning_engine_empty_call_rest_asyncio(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + await client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_reasoning_engine_execution_service_rest_asyncio_lro_client(): if not HAS_ASYNC_REST_EXTRA: pytest.skip( @@ -5449,6 +6295,7 @@ def test_reasoning_engine_execution_service_base_transport(): "query_reasoning_engine", "stream_query_reasoning_engine", "async_query_reasoning_engine", + "cancel_async_query_reasoning_engine", "set_iam_policy", "get_iam_policy", "test_iam_permissions", @@ -5742,6 +6589,9 @@ def test_reasoning_engine_execution_service_client_transport_session_collision( session1 = client1.transport.async_query_reasoning_engine._session session2 = client2.transport.async_query_reasoning_engine._session assert session1 != session2 + session1 = client1.transport.cancel_async_query_reasoning_engine._session + session2 = client2.transport.cancel_async_query_reasoning_engine._session + assert session1 != session2 def test_reasoning_engine_execution_service_grpc_transport_channel(): @@ -6208,6 +7058,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6313,7 +7195,41 @@ async def test_cancel_operation_field_headers_async(): ) in kw["metadata"] -def test_cancel_operation_from_dict(): +def test_cancel_operation_from_dict(): + client = ReasoningEngineExecutionServiceClient( + 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 = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_cancel_operation_flattened(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6322,16 +7238,15 @@ def test_cancel_operation_from_dict(): # Designate an appropriate return value for the call. call.return_value = None - response = client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() @pytest.mark.asyncio -async def test_cancel_operation_from_dict_async(): +async def test_cancel_operation_flattened_async(): client = ReasoningEngineExecutionServiceAsyncClient( credentials=async_anonymous_credentials(), ) @@ -6339,12 +7254,11 @@ async def test_cancel_operation_from_dict_async(): 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() + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() def test_wait_operation(transport: str = "grpc"): @@ -6492,6 +7406,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6637,6 +7585,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6782,6 +7764,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6927,6 +7943,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7072,6 +8122,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7236,6 +8320,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7403,6 +8522,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7580,6 +8734,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_service.py b/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_service.py index 82f4bd7ead..60463087f3 100644 --- a/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_reasoning_engine_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -149,6 +144,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ReasoningEngineServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -171,6 +167,10 @@ def test__get_default_mtls_endpoint(): ReasoningEngineServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ReasoningEngineServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2654,11 +2654,7 @@ async def test_list_reasoning_engines_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_reasoning_engines(request={}) - ).pages: + async for page_ in (await client.list_reasoning_engines(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3479,7 +3475,7 @@ def test_create_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_reasoning_engine_rest_unset_required_fields(): @@ -3669,7 +3665,7 @@ def test_get_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_reasoning_engine_rest_unset_required_fields(): @@ -3864,7 +3860,7 @@ def test_list_reasoning_engines_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_reasoning_engines_rest_unset_required_fields(): @@ -4121,7 +4117,7 @@ def test_update_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_reasoning_engine_rest_unset_required_fields(): @@ -4311,7 +4307,7 @@ def test_delete_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_reasoning_engine_rest_unset_required_fields(): @@ -9262,6 +9258,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ReasoningEngineServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9401,6 +9429,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ReasoningEngineServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9546,6 +9606,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9691,6 +9785,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9836,6 +9964,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9981,6 +10143,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10126,6 +10322,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10290,6 +10520,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10457,6 +10722,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10634,6 +10934,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_schedule_service.py b/tests/unit/gapic/aiplatform_v1/test_schedule_service.py index c8a04a13b4..5df9853562 100644 --- a/tests/unit/gapic/aiplatform_v1/test_schedule_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_schedule_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -164,6 +159,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ScheduleServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -185,6 +181,10 @@ def test__get_default_mtls_endpoint(): assert ( ScheduleServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ScheduleServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2935,11 +2935,7 @@ async def test_list_schedules_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_schedules(request={}) - ).pages: + async for page_ in (await client.list_schedules(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4048,7 +4044,7 @@ def test_create_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_schedule_rest_unset_required_fields(): @@ -4236,7 +4232,7 @@ def test_delete_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_schedule_rest_unset_required_fields(): @@ -4413,7 +4409,7 @@ def test_get_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_schedule_rest_unset_required_fields(): @@ -4601,7 +4597,7 @@ def test_list_schedules_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_schedules_rest_unset_required_fields(): @@ -4849,7 +4845,7 @@ def test_pause_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_pause_schedule_rest_unset_required_fields(): @@ -5025,7 +5021,7 @@ def test_resume_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_resume_schedule_rest_unset_required_fields(): @@ -5203,7 +5199,7 @@ def test_update_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_schedule_rest_unset_required_fields(): @@ -11637,6 +11633,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ScheduleServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11776,6 +11804,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ScheduleServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11921,6 +11981,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12066,6 +12160,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ScheduleServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12211,6 +12339,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ScheduleServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12356,6 +12518,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ScheduleServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12497,6 +12693,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12661,6 +12891,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12828,6 +13093,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13005,6 +13305,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_session_service.py b/tests/unit/gapic/aiplatform_v1/test_session_service.py index 6aecda95c3..aa9c08eaf0 100644 --- a/tests/unit/gapic/aiplatform_v1/test_session_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_session_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -148,6 +143,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert SessionServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -169,6 +165,10 @@ def test__get_default_mtls_endpoint(): assert ( SessionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + SessionServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2534,11 +2534,7 @@ async def test_list_sessions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_sessions(request={}) - ).pages: + async for page_ in (await client.list_sessions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3725,11 +3721,7 @@ async def test_list_events_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_events(request={}) - ).pages: + async for page_ in (await client.list_events(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4174,7 +4166,7 @@ def test_create_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_session_rest_unset_required_fields(): @@ -4368,7 +4360,7 @@ def test_get_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_session_rest_unset_required_fields(): @@ -4557,7 +4549,7 @@ def test_list_sessions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_sessions_rest_unset_required_fields(): @@ -4810,7 +4802,7 @@ def test_update_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_session_rest_unset_required_fields(): @@ -4999,7 +4991,7 @@ def test_delete_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_session_rest_unset_required_fields(): @@ -5186,7 +5178,7 @@ def test_list_events_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_events_rest_unset_required_fields(): @@ -5442,7 +5434,7 @@ def test_append_event_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_append_event_rest_unset_required_fields(): @@ -11326,6 +11318,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = SessionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11465,6 +11489,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = SessionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11610,6 +11666,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11755,6 +11845,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = SessionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11900,6 +12024,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = SessionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12045,6 +12203,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = SessionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12186,6 +12378,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12350,6 +12576,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12517,6 +12778,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12694,6 +12990,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py b/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py index 770c7e3031..af00ae678c 100644 --- a/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -144,6 +139,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert SpecialistPoolServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -166,6 +162,10 @@ def test__get_default_mtls_endpoint(): SpecialistPoolServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + SpecialistPoolServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2651,11 +2651,7 @@ async def test_list_specialist_pools_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_specialist_pools(request={}) - ).pages: + async for page_ in (await client.list_specialist_pools(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3476,7 +3472,7 @@ def test_create_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_specialist_pool_rest_unset_required_fields(): @@ -3666,7 +3662,7 @@ def test_get_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_specialist_pool_rest_unset_required_fields(): @@ -3861,7 +3857,7 @@ def test_list_specialist_pools_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_specialist_pools_rest_unset_required_fields(): @@ -4122,7 +4118,7 @@ def test_delete_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_specialist_pool_rest_unset_required_fields(): @@ -4304,7 +4300,7 @@ def test_update_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_specialist_pool_rest_unset_required_fields(): @@ -9024,6 +9020,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = SpecialistPoolServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9163,6 +9191,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = SpecialistPoolServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9308,6 +9368,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9453,6 +9547,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9598,6 +9726,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9743,6 +9905,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9886,6 +10082,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10050,6 +10280,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10217,6 +10482,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10394,6 +10694,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py index 537993c276..31e92ed775 100644 --- a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -157,6 +152,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert TensorboardServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -179,6 +175,10 @@ def test__get_default_mtls_endpoint(): TensorboardServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + TensorboardServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2993,11 +2993,7 @@ async def test_list_tensorboards_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tensorboards(request={}) - ).pages: + async for page_ in (await client.list_tensorboards(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5698,9 +5694,7 @@ async def test_list_tensorboard_experiments_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_tensorboard_experiments(request={}) ).pages: pages.append(page_) @@ -8047,11 +8041,7 @@ async def test_list_tensorboard_runs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tensorboard_runs(request={}) - ).pages: + async for page_ in (await client.list_tensorboard_runs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -10489,9 +10479,7 @@ async def test_list_tensorboard_time_series_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_tensorboard_time_series(request={}) ).pages: pages.append(page_) @@ -13184,9 +13172,7 @@ async def test_export_tensorboard_time_series_data_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.export_tensorboard_time_series_data(request={}) ).pages: pages.append(page_) @@ -13308,7 +13294,7 @@ def test_create_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_rest_unset_required_fields(): @@ -13494,7 +13480,7 @@ def test_get_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_rest_unset_required_fields(): @@ -13677,7 +13663,7 @@ def test_update_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_rest_unset_required_fields(): @@ -13879,7 +13865,7 @@ def test_list_tensorboards_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboards_rest_unset_required_fields(): @@ -14136,7 +14122,7 @@ def test_delete_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_rest_unset_required_fields(): @@ -14321,7 +14307,7 @@ def test_read_tensorboard_usage_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_usage_rest_unset_required_fields(): @@ -14508,7 +14494,7 @@ def test_read_tensorboard_size_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_size_rest_unset_required_fields(): @@ -14717,7 +14703,7 @@ def test_create_tensorboard_experiment_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_experiment_rest_unset_required_fields(): @@ -14920,7 +14906,7 @@ def test_get_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_experiment_rest_unset_required_fields(): @@ -15105,7 +15091,7 @@ def test_update_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_experiment_rest_unset_required_fields(): @@ -15320,7 +15306,7 @@ def test_list_tensorboard_experiments_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_experiments_rest_unset_required_fields(): @@ -15587,7 +15573,7 @@ def test_delete_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_experiment_rest_unset_required_fields(): @@ -15788,7 +15774,7 @@ def test_create_tensorboard_run_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_run_rest_unset_required_fields(): @@ -15989,7 +15975,7 @@ def test_batch_create_tensorboard_runs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_tensorboard_runs_rest_unset_required_fields(): @@ -16191,7 +16177,7 @@ def test_get_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_run_rest_unset_required_fields(): @@ -16374,7 +16360,7 @@ def test_update_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_run_rest_unset_required_fields(): @@ -16583,7 +16569,7 @@ def test_list_tensorboard_runs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_runs_rest_unset_required_fields(): @@ -16845,7 +16831,7 @@ def test_delete_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_run_rest_unset_required_fields(): @@ -17033,7 +17019,7 @@ def test_batch_create_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_tensorboard_time_series_rest_unset_required_fields(): @@ -17247,7 +17233,7 @@ def test_create_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_time_series_rest_unset_required_fields(): @@ -17452,7 +17438,7 @@ def test_get_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_time_series_rest_unset_required_fields(): @@ -17637,7 +17623,7 @@ def test_update_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_time_series_rest_unset_required_fields(): @@ -17854,7 +17840,7 @@ def test_list_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_time_series_rest_unset_required_fields(): @@ -18122,7 +18108,7 @@ def test_delete_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_time_series_rest_unset_required_fields(): @@ -18330,7 +18316,7 @@ def test_batch_read_tensorboard_time_series_data_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_read_tensorboard_time_series_data_rest_unset_required_fields(): @@ -18540,7 +18526,7 @@ def test_read_tensorboard_time_series_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_time_series_data_rest_unset_required_fields(): @@ -18746,7 +18732,7 @@ def test_read_tensorboard_blob_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_blob_data_rest_unset_required_fields(): @@ -18941,7 +18927,7 @@ def test_write_tensorboard_experiment_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_tensorboard_experiment_data_rest_unset_required_fields(): @@ -19153,7 +19139,7 @@ def test_write_tensorboard_run_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_tensorboard_run_data_rest_unset_required_fields(): @@ -19363,7 +19349,7 @@ def test_export_tensorboard_time_series_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_tensorboard_time_series_data_rest_unset_required_fields(): @@ -35407,6 +35393,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = TensorboardServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35546,6 +35564,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = TensorboardServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35691,6 +35741,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35836,6 +35920,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = TensorboardServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35981,6 +36099,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = TensorboardServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36126,6 +36278,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = TensorboardServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36267,6 +36453,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36431,6 +36651,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36598,6 +36853,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36775,6 +37065,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py index 510aa8c4f7..8fe8aa1903 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -147,6 +142,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VertexRagDataServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -169,6 +165,10 @@ def test__get_default_mtls_endpoint(): VertexRagDataServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VertexRagDataServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2998,11 +2998,7 @@ async def test_list_rag_corpora_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_corpora(request={}) - ).pages: + async for page_ in (await client.list_rag_corpora(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4940,11 +4936,7 @@ async def test_list_rag_files_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_files(request={}) - ).pages: + async for page_ in (await client.list_rag_files(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6076,7 +6068,7 @@ def test_create_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_rag_corpus_rest_unset_required_fields(): @@ -6272,7 +6264,7 @@ def test_update_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_rag_corpus_rest_unset_required_fields(): @@ -6464,7 +6456,7 @@ def test_get_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_corpus_rest_unset_required_fields(): @@ -6654,7 +6646,7 @@ def test_list_rag_corpora_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_corpora_rest_unset_required_fields(): @@ -6907,7 +6899,7 @@ def test_delete_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_corpus_rest_unset_required_fields(): @@ -7087,7 +7079,7 @@ def test_upload_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upload_rag_file_rest_unset_required_fields(): @@ -7304,7 +7296,7 @@ def test_import_rag_files_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_rag_files_rest_unset_required_fields(): @@ -7496,7 +7488,7 @@ def test_get_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_file_rest_unset_required_fields(): @@ -7683,7 +7675,7 @@ def test_list_rag_files_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_files_rest_unset_required_fields(): @@ -7937,7 +7929,7 @@ def test_delete_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_file_rest_unset_required_fields(): @@ -8117,7 +8109,7 @@ def test_update_rag_engine_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_rag_engine_config_rest_unset_required_fields(): @@ -8302,7 +8294,7 @@ def test_get_rag_engine_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_engine_config_rest_unset_required_fields(): @@ -15939,6 +15931,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VertexRagDataServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16078,6 +16102,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VertexRagDataServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16223,6 +16279,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16368,6 +16458,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16513,6 +16637,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16658,6 +16816,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16801,6 +16993,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16965,6 +17191,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17132,6 +17393,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17309,6 +17605,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py index 9df7f5326c..022b8b3126 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -145,6 +140,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VertexRagServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -167,6 +163,10 @@ def test__get_default_mtls_endpoint(): VertexRagServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VertexRagServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3229,7 +3229,7 @@ def test_retrieve_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_retrieve_contexts_rest_unset_required_fields(): @@ -3418,7 +3418,7 @@ def test_augment_prompt_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_augment_prompt_rest_unset_required_fields(): @@ -3610,7 +3610,7 @@ def test_corroborate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_corroborate_content_rest_unset_required_fields(): @@ -3793,7 +3793,7 @@ def test_ask_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_ask_contexts_rest_unset_required_fields(): @@ -3988,7 +3988,7 @@ def test_async_retrieve_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_async_retrieve_contexts_rest_unset_required_fields(): @@ -8287,6 +8287,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VertexRagServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8426,6 +8458,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VertexRagServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8571,6 +8635,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8716,6 +8814,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VertexRagServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8861,6 +8993,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VertexRagServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9006,6 +9172,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VertexRagServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9147,6 +9347,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9311,6 +9545,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9478,6 +9747,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9655,6 +9959,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1/test_vizier_service.py b/tests/unit/gapic/aiplatform_v1/test_vizier_service.py index 01fcbbcea9..c1511769cc 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vizier_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vizier_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -141,6 +136,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VizierServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -162,6 +158,10 @@ def test__get_default_mtls_endpoint(): assert ( VizierServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VizierServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2505,11 +2505,7 @@ async def test_list_studies_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_studies(request={}) - ).pages: + async for page_ in (await client.list_studies(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4601,11 +4597,7 @@ async def test_list_trials_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_trials(request={}) - ).pages: + async for page_ in (await client.list_trials(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6421,7 +6413,7 @@ def test_create_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_study_rest_unset_required_fields(): @@ -6606,7 +6598,7 @@ def test_get_study_rest_required_fields(request_type=vizier_service.GetStudyRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_study_rest_unset_required_fields(): @@ -6790,7 +6782,7 @@ def test_list_studies_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_studies_rest_unset_required_fields(): @@ -7035,7 +7027,7 @@ def test_delete_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_study_rest_unset_required_fields(): @@ -7215,7 +7207,7 @@ def test_lookup_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_lookup_study_rest_unset_required_fields(): @@ -7411,7 +7403,7 @@ def test_suggest_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_suggest_trials_rest_unset_required_fields(): @@ -7541,7 +7533,7 @@ def test_create_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_trial_rest_unset_required_fields(): @@ -7729,7 +7721,7 @@ def test_get_trial_rest_required_fields(request_type=vizier_service.GetTrialRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_trial_rest_unset_required_fields(): @@ -7916,7 +7908,7 @@ def test_list_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_trials_rest_unset_required_fields(): @@ -8173,7 +8165,7 @@ def test_add_trial_measurement_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_trial_measurement_rest_unset_required_fields(): @@ -8302,7 +8294,7 @@ def test_complete_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_complete_trial_rest_unset_required_fields(): @@ -8419,7 +8411,7 @@ def test_delete_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_trial_rest_unset_required_fields(): @@ -8604,7 +8596,7 @@ def test_check_trial_early_stopping_state_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_check_trial_early_stopping_state_rest_unset_required_fields(): @@ -8725,7 +8717,7 @@ def test_stop_trial_rest_required_fields(request_type=vizier_service.StopTrialRe expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stop_trial_rest_unset_required_fields(): @@ -8850,7 +8842,7 @@ def test_list_optimal_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_optimal_trials_rest_unset_required_fields(): @@ -17432,6 +17424,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VizierServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17571,6 +17595,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VizierServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17716,6 +17772,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17861,6 +17951,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VizierServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18006,6 +18130,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VizierServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18151,6 +18309,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VizierServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18292,6 +18484,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18456,6 +18682,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18623,6 +18884,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18800,6 +19096,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/__init__.py b/tests/unit/gapic/aiplatform_v1beta1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/__init__.py +++ b/tests/unit/gapic/aiplatform_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py index 6474c6d30f..b1fb9e3b59 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -159,6 +154,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert DatasetServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -180,6 +176,10 @@ def test__get_default_mtls_endpoint(): assert ( DatasetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + DatasetServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2914,11 +2914,7 @@ async def test_list_datasets_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_datasets(request={}) - ).pages: + async for page_ in (await client.list_datasets(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5945,11 +5941,7 @@ async def test_list_dataset_versions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_dataset_versions(request={}) - ).pages: + async for page_ in (await client.list_dataset_versions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6815,11 +6807,7 @@ async def test_list_data_items_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_data_items(request={}) - ).pages: + async for page_ in (await client.list_data_items(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7284,11 +7272,7 @@ async def test_search_data_items_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_data_items(request={}) - ).pages: + async for page_ in (await client.search_data_items(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7834,11 +7818,7 @@ async def test_list_saved_queries_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_saved_queries(request={}) - ).pages: + async for page_ in (await client.list_saved_queries(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9055,11 +9035,7 @@ async def test_list_annotations_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_annotations(request={}) - ).pages: + async for page_ in (await client.list_annotations(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9665,7 +9641,7 @@ def test_create_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_dataset_rest_unset_required_fields(): @@ -9853,7 +9829,7 @@ def test_get_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_dataset_rest_unset_required_fields(): @@ -10029,7 +10005,7 @@ def test_update_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_dataset_rest_unset_required_fields(): @@ -10229,7 +10205,7 @@ def test_list_datasets_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_datasets_rest_unset_required_fields(): @@ -10482,7 +10458,7 @@ def test_delete_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_dataset_rest_unset_required_fields(): @@ -10660,7 +10636,7 @@ def test_import_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_data_rest_unset_required_fields(): @@ -10852,7 +10828,7 @@ def test_export_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_data_rest_unset_required_fields(): @@ -11053,7 +11029,7 @@ def test_create_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_dataset_version_rest_unset_required_fields(): @@ -11244,7 +11220,7 @@ def test_update_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_dataset_version_rest_unset_required_fields(): @@ -11442,7 +11418,7 @@ def test_delete_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_dataset_version_rest_unset_required_fields(): @@ -11626,7 +11602,7 @@ def test_get_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_dataset_version_rest_unset_required_fields(): @@ -11821,7 +11797,7 @@ def test_list_dataset_versions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_dataset_versions_rest_unset_required_fields(): @@ -12083,7 +12059,7 @@ def test_restore_dataset_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_restore_dataset_version_rest_unset_required_fields(): @@ -12271,7 +12247,7 @@ def test_list_data_items_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_data_items_rest_unset_required_fields(): @@ -12546,7 +12522,7 @@ def test_search_data_items_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_data_items_rest_unset_required_fields(): @@ -12763,7 +12739,7 @@ def test_list_saved_queries_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_saved_queries_rest_unset_required_fields(): @@ -13024,7 +13000,7 @@ def test_delete_saved_query_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_saved_query_rest_unset_required_fields(): @@ -13208,7 +13184,7 @@ def test_get_annotation_spec_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_annotation_spec_rest_unset_required_fields(): @@ -13400,7 +13376,7 @@ def test_list_annotations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_annotations_rest_unset_required_fields(): @@ -13658,7 +13634,7 @@ def test_assess_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_assess_data_rest_unset_required_fields(): @@ -13780,7 +13756,7 @@ def test_assemble_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_assemble_data_rest_unset_required_fields(): @@ -25205,6 +25181,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = DatasetServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25344,6 +25352,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = DatasetServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25489,6 +25529,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25634,6 +25708,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = DatasetServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25779,6 +25887,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = DatasetServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25924,6 +26066,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = DatasetServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26065,6 +26241,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26229,6 +26439,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26396,6 +26641,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26573,6 +26853,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = DatasetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = DatasetServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = DatasetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py index d29fd17dec..e8e806b79b 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -157,6 +152,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -183,6 +179,10 @@ def test__get_default_mtls_endpoint(): DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + DeploymentResourcePoolServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2763,9 +2763,7 @@ async def test_list_deployment_resource_pools_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_deployment_resource_pools(request={}) ).pages: pages.append(page_) @@ -4045,11 +4043,7 @@ async def test_query_deployed_models_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.query_deployed_models(request={}) - ).pages: + async for page_ in (await client.query_deployed_models(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4177,7 +4171,7 @@ def test_create_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_deployment_resource_pool_rest_unset_required_fields(): @@ -4379,7 +4373,7 @@ def test_get_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_deployment_resource_pool_rest_unset_required_fields(): @@ -4577,7 +4571,7 @@ def test_list_deployment_resource_pools_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_deployment_resource_pools_rest_unset_required_fields(): @@ -4846,7 +4840,7 @@ def test_update_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_deployment_resource_pool_rest_unset_required_fields(): @@ -5048,7 +5042,7 @@ def test_delete_deployment_resource_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_deployment_resource_pool_rest_unset_required_fields(): @@ -5246,7 +5240,7 @@ def test_query_deployed_models_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_deployed_models_rest_unset_required_fields(): @@ -10531,6 +10525,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10670,6 +10696,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10815,6 +10873,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10960,6 +11052,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11105,6 +11231,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11250,6 +11410,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = DeploymentResourcePoolServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11395,6 +11589,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11559,6 +11787,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11726,6 +11989,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11903,6 +12201,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = DeploymentResourcePoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = DeploymentResourcePoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = DeploymentResourcePoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py index cd07907012..4389ee40b1 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -155,6 +150,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert EndpointServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -176,6 +172,10 @@ def test__get_default_mtls_endpoint(): assert ( EndpointServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + EndpointServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2597,11 +2597,7 @@ async def test_list_endpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_endpoints(request={}) - ).pages: + async for page_ in (await client.list_endpoints(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5617,7 +5613,7 @@ def test_create_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_endpoint_rest_unset_required_fields(): @@ -5805,7 +5801,7 @@ def test_get_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_endpoint_rest_unset_required_fields(): @@ -5994,7 +5990,7 @@ def test_list_endpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_endpoints_rest_unset_required_fields(): @@ -6243,7 +6239,7 @@ def test_update_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_endpoint_rest_unset_required_fields(): @@ -6435,7 +6431,7 @@ def test_update_endpoint_long_running_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_endpoint_long_running_rest_unset_required_fields(): @@ -6614,7 +6610,7 @@ def test_delete_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_endpoint_rest_unset_required_fields(): @@ -6794,7 +6790,7 @@ def test_deploy_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_model_rest_unset_required_fields(): @@ -7002,7 +6998,7 @@ def test_undeploy_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_undeploy_model_rest_unset_required_fields(): @@ -7199,7 +7195,7 @@ def test_mutate_deployed_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_mutate_deployed_model_rest_unset_required_fields(): @@ -7409,7 +7405,7 @@ def test_set_publisher_model_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_set_publisher_model_config_rest_unset_required_fields(): @@ -7610,7 +7606,7 @@ def test_fetch_publisher_model_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_fetch_publisher_model_config_rest_unset_required_fields(): @@ -15334,6 +15330,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = EndpointServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15473,6 +15501,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = EndpointServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15618,6 +15678,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15763,6 +15857,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = EndpointServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15908,6 +16036,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = EndpointServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16053,6 +16215,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = EndpointServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16194,6 +16390,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16358,6 +16588,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16525,6 +16790,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16702,6 +17002,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = EndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = EndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = EndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py index 69417b6158..86e9bc2807 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -147,6 +142,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert EvaluationServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -169,6 +165,10 @@ def test__get_default_mtls_endpoint(): EvaluationServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + EvaluationServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2236,7 +2236,7 @@ def test_evaluate_instances_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_evaluate_instances_rest_unset_required_fields(): @@ -2360,7 +2360,7 @@ def test_evaluate_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_evaluate_dataset_rest_unset_required_fields(): @@ -2498,7 +2498,7 @@ def test_generate_instance_rubrics_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_generate_instance_rubrics_rest_unset_required_fields(): @@ -5977,6 +5977,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = EvaluationServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6116,6 +6148,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = EvaluationServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6261,6 +6325,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6406,6 +6504,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = EvaluationServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6551,6 +6683,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = EvaluationServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6696,6 +6862,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = EvaluationServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6837,6 +7037,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7001,6 +7235,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7168,6 +7437,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7345,6 +7649,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = EvaluationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = EvaluationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_example_store_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_example_store_service.py index 22ace2e329..199a088775 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_example_store_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_example_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -149,6 +144,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ExampleStoreServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -171,6 +167,10 @@ def test__get_default_mtls_endpoint(): ExampleStoreServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ExampleStoreServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3338,11 +3338,7 @@ async def test_list_example_stores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_example_stores(request={}) - ).pages: + async for page_ in (await client.list_example_stores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4490,11 +4486,7 @@ async def test_fetch_examples_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.fetch_examples(request={}) - ).pages: + async for page_ in (await client.fetch_examples(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4614,7 +4606,7 @@ def test_create_example_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_example_store_rest_unset_required_fields(): @@ -4802,7 +4794,7 @@ def test_get_example_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_example_store_rest_unset_required_fields(): @@ -4985,7 +4977,7 @@ def test_update_example_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_example_store_rest_unset_required_fields(): @@ -5172,7 +5164,7 @@ def test_delete_example_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_example_store_rest_unset_required_fields(): @@ -5364,7 +5356,7 @@ def test_list_example_stores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_example_stores_rest_unset_required_fields(): @@ -5615,7 +5607,7 @@ def test_upsert_examples_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upsert_examples_rest_unset_required_fields(): @@ -5744,7 +5736,7 @@ def test_remove_examples_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_remove_examples_rest_unset_required_fields(): @@ -5865,7 +5857,7 @@ def test_search_examples_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_examples_rest_unset_required_fields(): @@ -5986,7 +5978,7 @@ def test_fetch_examples_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_fetch_examples_rest_unset_required_fields(): @@ -12174,6 +12166,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ExampleStoreServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12313,6 +12337,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ExampleStoreServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12458,6 +12514,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ExampleStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12603,6 +12693,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ExampleStoreServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12748,6 +12872,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ExampleStoreServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12893,6 +13051,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ExampleStoreServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13036,6 +13228,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ExampleStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13200,6 +13426,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ExampleStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13367,6 +13628,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ExampleStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13544,6 +13840,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ExampleStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ExampleStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ExampleStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py index a921158b10..b2a88bb6b3 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -141,6 +136,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ExtensionExecutionServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -165,6 +161,10 @@ def test__get_default_mtls_endpoint(): ExtensionExecutionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ExtensionExecutionServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2212,7 +2212,7 @@ def test_execute_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_execute_extension_rest_unset_required_fields(): @@ -2407,7 +2407,7 @@ def test_query_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_extension_rest_unset_required_fields(): @@ -5564,6 +5564,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ExtensionExecutionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5703,6 +5735,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ExtensionExecutionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5848,6 +5912,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ExtensionExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5993,6 +6091,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ExtensionExecutionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6138,6 +6270,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ExtensionExecutionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6283,6 +6449,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ExtensionExecutionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6428,6 +6628,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ExtensionExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6592,6 +6826,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ExtensionExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6759,6 +7028,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ExtensionExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6936,6 +7240,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ExtensionExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ExtensionExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ExtensionExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py index a6fc1f29dd..7744197e11 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -150,6 +145,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ExtensionRegistryServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -172,6 +168,10 @@ def test__get_default_mtls_endpoint(): ExtensionRegistryServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ExtensionRegistryServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2597,11 +2597,7 @@ async def test_list_extensions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_extensions(request={}) - ).pages: + async for page_ in (await client.list_extensions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3393,7 +3389,7 @@ def test_import_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_extension_rest_unset_required_fields(): @@ -3579,7 +3575,7 @@ def test_get_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_extension_rest_unset_required_fields(): @@ -3770,7 +3766,7 @@ def test_list_extensions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_extensions_rest_unset_required_fields(): @@ -4024,7 +4020,7 @@ def test_update_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_extension_rest_unset_required_fields(): @@ -4219,7 +4215,7 @@ def test_delete_extension_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_extension_rest_unset_required_fields(): @@ -9315,6 +9311,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ExtensionRegistryServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9454,6 +9482,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ExtensionRegistryServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9599,6 +9659,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ExtensionRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9744,6 +9838,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ExtensionRegistryServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9889,6 +10017,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ExtensionRegistryServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10034,6 +10196,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ExtensionRegistryServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10179,6 +10375,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ExtensionRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10343,6 +10573,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ExtensionRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10510,6 +10775,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ExtensionRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10687,6 +10987,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ExtensionRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ExtensionRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ExtensionRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py index c68e7c0f80..d6940df785 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -159,6 +154,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -187,6 +183,10 @@ def test__get_default_mtls_endpoint(): FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureOnlineStoreAdminServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2798,11 +2798,7 @@ async def test_list_feature_online_stores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_online_stores(request={}) - ).pages: + async for page_ in (await client.list_feature_online_stores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4849,11 +4845,7 @@ async def test_list_feature_views_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_views(request={}) - ).pages: + async for page_ in (await client.list_feature_views(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6827,11 +6819,7 @@ async def test_list_feature_view_syncs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_view_syncs(request={}) - ).pages: + async for page_ in (await client.list_feature_view_syncs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6970,7 +6958,7 @@ def test_create_feature_online_store_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_online_store_rest_unset_required_fields(): @@ -7176,7 +7164,7 @@ def test_get_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_online_store_rest_unset_required_fields(): @@ -7374,7 +7362,7 @@ def test_list_feature_online_stores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_online_stores_rest_unset_required_fields(): @@ -7640,7 +7628,7 @@ def test_update_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_online_store_rest_unset_required_fields(): @@ -7842,7 +7830,7 @@ def test_delete_feature_online_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_online_store_rest_unset_required_fields(): @@ -8048,7 +8036,7 @@ def test_create_feature_view_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_view_rest_unset_required_fields(): @@ -8254,7 +8242,7 @@ def test_get_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_view_rest_unset_required_fields(): @@ -8451,7 +8439,7 @@ def test_list_feature_views_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_views_rest_unset_required_fields(): @@ -8712,7 +8700,7 @@ def test_update_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_view_rest_unset_required_fields(): @@ -8907,7 +8895,7 @@ def test_delete_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_view_rest_unset_required_fields(): @@ -9092,7 +9080,7 @@ def test_sync_feature_view_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_sync_feature_view_rest_unset_required_fields(): @@ -9279,7 +9267,7 @@ def test_get_feature_view_sync_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_view_sync_rest_unset_required_fields(): @@ -9477,7 +9465,7 @@ def test_list_feature_view_syncs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_view_syncs_rest_unset_required_fields(): @@ -18303,6 +18291,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18442,6 +18462,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18587,6 +18639,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18732,6 +18818,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18877,6 +18997,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19022,6 +19176,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19167,6 +19355,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19331,6 +19553,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19498,6 +19755,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19675,6 +19967,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureOnlineStoreAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureOnlineStoreAdminServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureOnlineStoreAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py index 20fda2df95..7baa8c7e52 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -141,6 +136,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -165,6 +161,10 @@ def test__get_default_mtls_endpoint(): FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureOnlineStoreServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2724,7 +2724,7 @@ def test_fetch_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_fetch_feature_values_rest_unset_required_fields(): @@ -2929,7 +2929,7 @@ def test_search_nearest_entities_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_nearest_entities_rest_unset_required_fields(): @@ -6564,6 +6564,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6703,6 +6735,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6848,6 +6912,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6993,6 +7091,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7138,6 +7270,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7283,6 +7449,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureOnlineStoreServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7428,6 +7628,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7592,6 +7826,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7759,6 +8028,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7936,6 +8240,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureOnlineStoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureOnlineStoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureOnlineStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py index 6baa279f25..9d63d0deeb 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -162,6 +157,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeatureRegistryServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -184,6 +180,10 @@ def test__get_default_mtls_endpoint(): FeatureRegistryServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeatureRegistryServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2711,11 +2711,7 @@ async def test_list_feature_groups_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_groups(request={}) - ).pages: + async for page_ in (await client.list_feature_groups(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5017,11 +5013,7 @@ async def test_list_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_features(request={}) - ).pages: + async for page_ in (await client.list_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6949,11 +6941,7 @@ async def test_list_feature_monitors_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_monitors(request={}) - ).pages: + async for page_ in (await client.list_feature_monitors(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -8956,11 +8944,7 @@ async def test_list_feature_monitor_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_feature_monitor_jobs(request={}) - ).pages: + async for page_ in (await client.list_feature_monitor_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9095,7 +9079,7 @@ def test_create_feature_group_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_group_rest_unset_required_fields(): @@ -9294,7 +9278,7 @@ def test_get_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_group_rest_unset_required_fields(): @@ -9489,7 +9473,7 @@ def test_list_feature_groups_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_groups_rest_unset_required_fields(): @@ -9746,7 +9730,7 @@ def test_update_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_group_rest_unset_required_fields(): @@ -9943,7 +9927,7 @@ def test_delete_feature_group_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_group_rest_unset_required_fields(): @@ -10140,7 +10124,7 @@ def test_create_feature_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_rest_unset_required_fields(): @@ -10338,7 +10322,7 @@ def test_batch_create_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_features_rest_unset_required_fields(): @@ -10528,7 +10512,7 @@ def test_get_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_rest_unset_required_fields(): @@ -10719,7 +10703,7 @@ def test_list_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_features_rest_unset_required_fields(): @@ -10975,7 +10959,7 @@ def test_update_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_rest_unset_required_fields(): @@ -11158,7 +11142,7 @@ def test_delete_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_rest_unset_required_fields(): @@ -11358,7 +11342,7 @@ def test_create_feature_monitor_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_monitor_rest_unset_required_fields(): @@ -11553,7 +11537,7 @@ def test_get_feature_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_monitor_rest_unset_required_fields(): @@ -11749,7 +11733,7 @@ def test_list_feature_monitors_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_monitors_rest_unset_required_fields(): @@ -12011,7 +11995,7 @@ def test_update_feature_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_monitor_rest_unset_required_fields(): @@ -12199,7 +12183,7 @@ def test_delete_feature_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_monitor_rest_unset_required_fields(): @@ -12385,7 +12369,7 @@ def test_create_feature_monitor_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_monitor_job_rest_unset_required_fields(): @@ -12586,7 +12570,7 @@ def test_get_feature_monitor_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_monitor_job_rest_unset_required_fields(): @@ -12782,7 +12766,7 @@ def test_list_feature_monitor_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_feature_monitor_jobs_rest_unset_required_fields(): @@ -24228,6 +24212,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeatureRegistryServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24367,6 +24383,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeatureRegistryServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24512,6 +24560,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24657,6 +24739,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24802,6 +24918,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24947,6 +25097,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeatureRegistryServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25092,6 +25276,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25256,6 +25474,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25423,6 +25676,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25600,6 +25888,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeatureRegistryServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeatureRegistryServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeatureRegistryServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py index 3b7c484410..6b7e57367e 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -139,6 +134,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ( FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint(None) is None @@ -169,6 +165,12 @@ def test__get_default_mtls_endpoint(): FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeaturestoreOnlineServingServiceClient._get_default_mtls_endpoint( + custom_endpoint + ) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2642,7 +2644,7 @@ def test_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_feature_values_rest_unset_required_fields(): @@ -2848,7 +2850,7 @@ def test_streaming_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_streaming_read_feature_values_rest_unset_required_fields(): @@ -3051,7 +3053,7 @@ def test_write_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_feature_values_rest_unset_required_fields(): @@ -6632,6 +6634,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6771,6 +6805,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6916,6 +6982,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7061,6 +7161,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7206,6 +7340,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7351,6 +7519,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeaturestoreOnlineServingServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7496,6 +7698,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7660,6 +7896,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7827,6 +8098,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8004,6 +8310,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeaturestoreOnlineServingServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeaturestoreOnlineServingServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeaturestoreOnlineServingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py index 4c34fd55e9..220ab3b45f 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -158,6 +153,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert FeaturestoreServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -180,6 +176,10 @@ def test__get_default_mtls_endpoint(): FeaturestoreServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + FeaturestoreServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2661,11 +2661,7 @@ async def test_list_featurestores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_featurestores(request={}) - ).pages: + async for page_ in (await client.list_featurestores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4629,11 +4625,7 @@ async def test_list_entity_types_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_entity_types(request={}) - ).pages: + async for page_ in (await client.list_entity_types(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6927,11 +6919,7 @@ async def test_list_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_features(request={}) - ).pages: + async for page_ in (await client.list_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9529,11 +9517,7 @@ async def test_search_features_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_features(request={}) - ).pages: + async for page_ in (await client.search_features(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9668,7 +9652,7 @@ def test_create_featurestore_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_featurestore_rest_unset_required_fields(): @@ -9859,7 +9843,7 @@ def test_get_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_featurestore_rest_unset_required_fields(): @@ -10055,7 +10039,7 @@ def test_list_featurestores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_featurestores_rest_unset_required_fields(): @@ -10310,7 +10294,7 @@ def test_update_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_featurestore_rest_unset_required_fields(): @@ -10499,7 +10483,7 @@ def test_delete_featurestore_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_featurestore_rest_unset_required_fields(): @@ -10700,7 +10684,7 @@ def test_create_entity_type_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_entity_type_rest_unset_required_fields(): @@ -10890,7 +10874,7 @@ def test_get_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_entity_type_rest_unset_required_fields(): @@ -11082,7 +11066,7 @@ def test_list_entity_types_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_entity_types_rest_unset_required_fields(): @@ -11340,7 +11324,7 @@ def test_update_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_entity_type_rest_unset_required_fields(): @@ -11531,7 +11515,7 @@ def test_delete_entity_type_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_entity_type_rest_unset_required_fields(): @@ -11728,7 +11712,7 @@ def test_create_feature_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_feature_rest_unset_required_fields(): @@ -11926,7 +11910,7 @@ def test_batch_create_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_features_rest_unset_required_fields(): @@ -12116,7 +12100,7 @@ def test_get_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_feature_rest_unset_required_fields(): @@ -12307,7 +12291,7 @@ def test_list_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_features_rest_unset_required_fields(): @@ -12562,7 +12546,7 @@ def test_update_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_feature_rest_unset_required_fields(): @@ -12747,7 +12731,7 @@ def test_delete_feature_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_rest_unset_required_fields(): @@ -12932,7 +12916,7 @@ def test_import_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_feature_values_rest_unset_required_fields(): @@ -13125,7 +13109,7 @@ def test_batch_read_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_read_feature_values_rest_unset_required_fields(): @@ -13319,7 +13303,7 @@ def test_export_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_feature_values_rest_unset_required_fields(): @@ -13513,7 +13497,7 @@ def test_delete_feature_values_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_feature_values_rest_unset_required_fields(): @@ -13699,7 +13683,7 @@ def test_search_features_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_features_rest_unset_required_fields(): @@ -25585,6 +25569,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = FeaturestoreServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25724,6 +25740,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = FeaturestoreServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25869,6 +25917,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26014,6 +26096,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26159,6 +26275,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26304,6 +26454,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = FeaturestoreServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26447,6 +26631,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26611,6 +26829,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26778,6 +27031,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26955,6 +27243,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = FeaturestoreServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = FeaturestoreServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = FeaturestoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py index c3006d90fe..9fb88af152 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -146,6 +141,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert GenAiCacheServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -168,6 +164,10 @@ def test__get_default_mtls_endpoint(): GenAiCacheServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + GenAiCacheServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3332,11 +3332,7 @@ async def test_list_cached_contents_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_cached_contents(request={}) - ).pages: + async for page_ in (await client.list_cached_contents(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3456,7 +3452,7 @@ def test_create_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_cached_content_rest_unset_required_fields(): @@ -3652,7 +3648,7 @@ def test_get_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_cached_content_rest_unset_required_fields(): @@ -3835,7 +3831,7 @@ def test_update_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_cached_content_rest_unset_required_fields(): @@ -4033,7 +4029,7 @@ def test_delete_cached_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_cached_content_rest_unset_required_fields(): @@ -4224,7 +4220,7 @@ def test_list_cached_contents_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_cached_contents_rest_unset_required_fields(): @@ -4962,6 +4958,10 @@ def test_create_cached_content_rest_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -5512,6 +5512,10 @@ def test_update_cached_content_rest_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -6924,6 +6928,10 @@ async def test_create_cached_content_rest_asyncio_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -7510,6 +7518,10 @@ async def test_update_cached_content_rest_asyncio_call_success(request_type): ], "blocking_confidence": 30, }, + "parallel_ai_search": { + "api_key": "api_key_value", + "custom_configs": {}, + }, "code_execution": {}, "url_context": {}, "computer_use": { @@ -9665,6 +9677,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = GenAiCacheServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9804,6 +9848,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = GenAiCacheServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9949,6 +10025,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10094,6 +10204,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10239,6 +10383,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10384,6 +10562,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = GenAiCacheServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10525,6 +10737,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10689,6 +10935,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10856,6 +11137,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11033,6 +11349,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = GenAiCacheServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = GenAiCacheServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = GenAiCacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py index df7d0116d0..09192a0bb2 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -153,6 +148,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert GenAiTuningServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -175,6 +171,10 @@ def test__get_default_mtls_endpoint(): GenAiTuningServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + GenAiTuningServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2638,11 +2638,7 @@ async def test_list_tuning_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tuning_jobs(request={}) - ).pages: + async for page_ in (await client.list_tuning_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3443,7 +3439,7 @@ def test_create_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tuning_job_rest_unset_required_fields(): @@ -3631,7 +3627,7 @@ def test_get_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tuning_job_rest_unset_required_fields(): @@ -3821,7 +3817,7 @@ def test_list_tuning_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tuning_jobs_rest_unset_required_fields(): @@ -4071,7 +4067,7 @@ def test_cancel_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_tuning_job_rest_unset_required_fields(): @@ -4255,7 +4251,7 @@ def test_rebase_tuned_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_rebase_tuned_model_rest_unset_required_fields(): @@ -9687,6 +9683,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = GenAiTuningServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9826,6 +9854,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = GenAiTuningServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9971,6 +10031,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10116,6 +10210,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10261,6 +10389,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10406,6 +10568,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = GenAiTuningServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10547,6 +10743,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10711,6 +10941,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10878,6 +11143,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11055,6 +11355,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = GenAiTuningServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = GenAiTuningServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = GenAiTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py index b3c79d89fb..aa09ddcd8f 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -151,6 +146,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert IndexEndpointServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -173,6 +169,10 @@ def test__get_default_mtls_endpoint(): IndexEndpointServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + IndexEndpointServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2673,11 +2673,7 @@ async def test_list_index_endpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_index_endpoints(request={}) - ).pages: + async for page_ in (await client.list_index_endpoints(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4565,7 +4561,7 @@ def test_create_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_index_endpoint_rest_unset_required_fields(): @@ -4755,7 +4751,7 @@ def test_get_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_index_endpoint_rest_unset_required_fields(): @@ -4950,7 +4946,7 @@ def test_list_index_endpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_index_endpoints_rest_unset_required_fields(): @@ -5207,7 +5203,7 @@ def test_update_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_index_endpoint_rest_unset_required_fields(): @@ -5405,7 +5401,7 @@ def test_delete_index_endpoint_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_index_endpoint_rest_unset_required_fields(): @@ -5585,7 +5581,7 @@ def test_deploy_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_index_rest_unset_required_fields(): @@ -5779,7 +5775,7 @@ def test_undeploy_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_undeploy_index_rest_unset_required_fields(): @@ -5974,7 +5970,7 @@ def test_mutate_deployed_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_mutate_deployed_index_rest_unset_required_fields(): @@ -12588,6 +12584,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = IndexEndpointServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12727,6 +12755,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = IndexEndpointServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12872,6 +12932,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13017,6 +13111,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13162,6 +13290,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13307,6 +13469,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = IndexEndpointServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13450,6 +13646,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13614,6 +13844,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13781,6 +14046,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13958,6 +14258,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = IndexEndpointServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = IndexEndpointServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = IndexEndpointServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py index a20b8e713b..a31a43be3d 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -146,6 +141,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert IndexServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -164,6 +160,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert IndexServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + IndexServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2750,11 +2750,7 @@ async def test_list_indexes_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_indexes(request={}) - ).pages: + async for page_ in (await client.list_indexes(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4024,7 +4020,7 @@ def test_create_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_index_rest_unset_required_fields(): @@ -4208,7 +4204,7 @@ def test_get_index_rest_required_fields(request_type=index_service.GetIndexReque expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_index_rest_unset_required_fields(): @@ -4388,7 +4384,7 @@ def test_import_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_index_rest_unset_required_fields(): @@ -4525,7 +4521,7 @@ def test_list_indexes_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_indexes_rest_unset_required_fields(): @@ -4773,7 +4769,7 @@ def test_update_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_index_rest_unset_required_fields(): @@ -4954,7 +4950,7 @@ def test_delete_index_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_index_rest_unset_required_fields(): @@ -5133,7 +5129,7 @@ def test_upsert_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upsert_datapoints_rest_unset_required_fields(): @@ -5256,7 +5252,7 @@ def test_remove_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_remove_datapoints_rest_unset_required_fields(): @@ -10966,6 +10962,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = IndexServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11105,6 +11133,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = IndexServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11250,6 +11310,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11395,6 +11489,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = IndexServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11540,6 +11668,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = IndexServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11685,6 +11847,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = IndexServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11826,6 +12022,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11990,6 +12220,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12157,6 +12422,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12334,6 +12634,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = IndexServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = IndexServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = IndexServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py index fe3b275af9..0435df6ba0 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -182,6 +177,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert JobServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -200,6 +196,9 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + JobServiceClient._get_default_mtls_endpoint(custom_endpoint) == custom_endpoint + ) def test__read_environment_variables(): @@ -2550,11 +2549,7 @@ async def test_list_custom_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_custom_jobs(request={}) - ).pages: + async for page_ in (await client.list_custom_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4530,11 +4525,7 @@ async def test_list_data_labeling_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_data_labeling_jobs(request={}) - ).pages: + async for page_ in (await client.list_data_labeling_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6529,9 +6520,7 @@ async def test_list_hyperparameter_tuning_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_hyperparameter_tuning_jobs(request={}) ).pages: pages.append(page_) @@ -8416,11 +8405,7 @@ async def test_list_nas_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_nas_jobs(request={}) - ).pages: + async for page_ in (await client.list_nas_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9945,11 +9930,7 @@ async def test_list_nas_trial_details_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_nas_trial_details(request={}) - ).pages: + async for page_ in (await client.list_nas_trial_details(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -11276,11 +11257,7 @@ async def test_list_batch_prediction_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_batch_prediction_jobs(request={}) - ).pages: + async for page_ in (await client.list_batch_prediction_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -12981,9 +12958,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.search_model_deployment_monitoring_stats_anomalies(request={}) ).pages: pages.append(page_) @@ -13933,9 +13908,7 @@ async def test_list_model_deployment_monitoring_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_deployment_monitoring_jobs(request={}) ).pages: pages.append(page_) @@ -15428,7 +15401,7 @@ def test_create_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_custom_job_rest_unset_required_fields(): @@ -15616,7 +15589,7 @@ def test_get_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_custom_job_rest_unset_required_fields(): @@ -15807,7 +15780,7 @@ def test_list_custom_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_custom_jobs_rest_unset_required_fields(): @@ -16061,7 +16034,7 @@ def test_delete_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_custom_job_rest_unset_required_fields(): @@ -16239,7 +16212,7 @@ def test_cancel_custom_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_custom_job_rest_unset_required_fields(): @@ -16423,7 +16396,7 @@ def test_create_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_data_labeling_job_rest_unset_required_fields(): @@ -16616,7 +16589,7 @@ def test_get_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_data_labeling_job_rest_unset_required_fields(): @@ -16811,7 +16784,7 @@ def test_list_data_labeling_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_data_labeling_jobs_rest_unset_required_fields(): @@ -17069,7 +17042,7 @@ def test_delete_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_data_labeling_job_rest_unset_required_fields(): @@ -17250,7 +17223,7 @@ def test_cancel_data_labeling_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_data_labeling_job_rest_unset_required_fields(): @@ -17436,7 +17409,7 @@ def test_create_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -17639,7 +17612,7 @@ def test_get_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -17839,7 +17812,7 @@ def test_list_hyperparameter_tuning_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_hyperparameter_tuning_jobs_rest_unset_required_fields(): @@ -18104,7 +18077,7 @@ def test_delete_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -18287,7 +18260,7 @@ def test_cancel_hyperparameter_tuning_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_hyperparameter_tuning_job_rest_unset_required_fields(): @@ -18468,7 +18441,7 @@ def test_create_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_nas_job_rest_unset_required_fields(): @@ -18654,7 +18627,7 @@ def test_get_nas_job_rest_required_fields(request_type=job_service.GetNasJobRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_nas_job_rest_unset_required_fields(): @@ -18841,7 +18814,7 @@ def test_list_nas_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_nas_jobs_rest_unset_required_fields(): @@ -19091,7 +19064,7 @@ def test_delete_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_nas_job_rest_unset_required_fields(): @@ -19265,7 +19238,7 @@ def test_cancel_nas_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_nas_job_rest_unset_required_fields(): @@ -19445,7 +19418,7 @@ def test_get_nas_trial_detail_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_nas_trial_detail_rest_unset_required_fields(): @@ -19637,7 +19610,7 @@ def test_list_nas_trial_details_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_nas_trial_details_rest_unset_required_fields(): @@ -19896,7 +19869,7 @@ def test_create_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_batch_prediction_job_rest_unset_required_fields(): @@ -20093,7 +20066,7 @@ def test_get_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_batch_prediction_job_rest_unset_required_fields(): @@ -20287,7 +20260,7 @@ def test_list_batch_prediction_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_batch_prediction_jobs_rest_unset_required_fields(): @@ -20546,7 +20519,7 @@ def test_delete_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_batch_prediction_job_rest_unset_required_fields(): @@ -20727,7 +20700,7 @@ def test_cancel_batch_prediction_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_batch_prediction_job_rest_unset_required_fields(): @@ -20919,7 +20892,7 @@ def test_create_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -21146,7 +21119,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_required_fields expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_model_deployment_monitoring_stats_anomalies_rest_unset_required_fields(): @@ -21435,7 +21408,7 @@ def test_get_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -21641,7 +21614,7 @@ def test_list_model_deployment_monitoring_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_deployment_monitoring_jobs_rest_unset_required_fields(): @@ -21912,7 +21885,7 @@ def test_update_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22120,7 +22093,7 @@ def test_delete_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22309,7 +22282,7 @@ def test_pause_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_pause_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -22498,7 +22471,7 @@ def test_resume_model_deployment_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_resume_model_deployment_monitoring_job_rest_unset_required_fields(): @@ -41942,6 +41915,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = JobServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42081,6 +42086,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = JobServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42226,6 +42263,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42371,6 +42442,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = JobServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42516,6 +42621,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = JobServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42661,6 +42800,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = JobServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42802,6 +42975,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42966,6 +43173,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43133,6 +43375,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43310,6 +43587,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = JobServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = JobServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py index 732326cfbf..3db3802ee9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -138,6 +133,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert LlmUtilityServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -160,6 +156,10 @@ def test__get_default_mtls_endpoint(): LlmUtilityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + LlmUtilityServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1804,7 +1804,7 @@ def test_compute_tokens_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_compute_tokens_rest_unset_required_fields(): @@ -4505,6 +4505,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = LlmUtilityServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4644,6 +4676,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = LlmUtilityServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4789,6 +4853,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4934,6 +5032,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5079,6 +5211,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5224,6 +5390,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = LlmUtilityServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5365,6 +5565,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5529,6 +5763,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5696,6 +5965,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5873,6 +6177,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = LlmUtilityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = LlmUtilityServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = LlmUtilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py index bc15dd0b62..ccee0544f5 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -134,6 +129,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MatchServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -152,6 +148,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert MatchServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + MatchServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1899,7 +1899,7 @@ def test_find_neighbors_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_find_neighbors_rest_unset_required_fields(): @@ -2025,7 +2025,7 @@ def test_read_index_datapoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_index_datapoints_rest_unset_required_fields(): @@ -5043,6 +5043,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MatchServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5182,6 +5214,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MatchServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5327,6 +5391,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5472,6 +5570,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MatchServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5617,6 +5749,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MatchServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5762,6 +5928,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MatchServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5903,6 +6103,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6067,6 +6301,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6234,6 +6503,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6411,6 +6715,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MatchServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MatchServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_memory_bank_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_memory_bank_service.py index 991896577d..9885a9f0b3 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_memory_bank_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_memory_bank_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -147,6 +142,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MemoryBankServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -169,6 +165,10 @@ def test__get_default_mtls_endpoint(): MemoryBankServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + MemoryBankServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2899,11 +2899,7 @@ async def test_list_memories_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_memories(request={}) - ).pages: + async for page_ in (await client.list_memories(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4034,7 +4030,7 @@ def test_create_memory_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_memory_rest_unset_required_fields(): @@ -4224,7 +4220,7 @@ def test_get_memory_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_memory_rest_unset_required_fields(): @@ -4403,7 +4399,7 @@ def test_update_memory_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_memory_rest_unset_required_fields(): @@ -4593,7 +4589,7 @@ def test_list_memories_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_memories_rest_unset_required_fields(): @@ -4848,7 +4844,7 @@ def test_delete_memory_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_memory_rest_unset_required_fields(): @@ -5030,7 +5026,7 @@ def test_generate_memories_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_generate_memories_rest_unset_required_fields(): @@ -5211,7 +5207,7 @@ def test_retrieve_memories_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_retrieve_memories_rest_unset_required_fields(): @@ -10668,6 +10664,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MemoryBankServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10807,6 +10835,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MemoryBankServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10952,6 +11012,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MemoryBankServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11097,6 +11191,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MemoryBankServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11242,6 +11370,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MemoryBankServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11387,6 +11549,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MemoryBankServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11528,6 +11724,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MemoryBankServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11692,6 +11922,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MemoryBankServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11859,6 +12124,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MemoryBankServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12036,6 +12336,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MemoryBankServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MemoryBankServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MemoryBankServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py index 3ecd41f39c..f38801e10d 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -157,6 +152,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MetadataServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -178,6 +174,10 @@ def test__get_default_mtls_endpoint(): assert ( MetadataServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + MetadataServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2621,11 +2621,7 @@ async def test_list_metadata_stores_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_metadata_stores(request={}) - ).pages: + async for page_ in (await client.list_metadata_stores(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4211,11 +4207,7 @@ async def test_list_artifacts_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_artifacts(request={}) - ).pages: + async for page_ in (await client.list_artifacts(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6457,11 +6449,7 @@ async def test_list_contexts_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_contexts(request={}) - ).pages: + async for page_ in (await client.list_contexts(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -10093,11 +10081,7 @@ async def test_list_executions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_executions(request={}) - ).pages: + async for page_ in (await client.list_executions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -13096,11 +13080,7 @@ async def test_list_metadata_schemas_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_metadata_schemas(request={}) - ).pages: + async for page_ in (await client.list_metadata_schemas(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -13562,7 +13542,7 @@ def test_create_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_metadata_store_rest_unset_required_fields(): @@ -13754,7 +13734,7 @@ def test_get_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_metadata_store_rest_unset_required_fields(): @@ -13945,7 +13925,7 @@ def test_list_metadata_stores_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_metadata_stores_rest_unset_required_fields(): @@ -14202,7 +14182,7 @@ def test_delete_metadata_store_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_metadata_store_rest_unset_required_fields(): @@ -14383,7 +14363,7 @@ def test_create_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_artifact_rest_unset_required_fields(): @@ -14575,7 +14555,7 @@ def test_get_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_artifact_rest_unset_required_fields(): @@ -14764,7 +14744,7 @@ def test_list_artifacts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_artifacts_rest_unset_required_fields(): @@ -15022,7 +15002,7 @@ def test_update_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_artifact_rest_unset_required_fields(): @@ -15217,7 +15197,7 @@ def test_delete_artifact_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_artifact_rest_unset_required_fields(): @@ -15401,7 +15381,7 @@ def test_purge_artifacts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_artifacts_rest_unset_required_fields(): @@ -15590,7 +15570,7 @@ def test_create_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_context_rest_unset_required_fields(): @@ -15782,7 +15762,7 @@ def test_get_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_context_rest_unset_required_fields(): @@ -15971,7 +15951,7 @@ def test_list_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_contexts_rest_unset_required_fields(): @@ -16229,7 +16209,7 @@ def test_update_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_context_rest_unset_required_fields(): @@ -16429,7 +16409,7 @@ def test_delete_context_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_context_rest_unset_required_fields(): @@ -16621,7 +16601,7 @@ def test_purge_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_contexts_rest_unset_required_fields(): @@ -16815,7 +16795,7 @@ def test_add_context_artifacts_and_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_context_artifacts_and_executions_rest_unset_required_fields(): @@ -17010,7 +16990,7 @@ def test_add_context_children_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_context_children_rest_unset_required_fields(): @@ -17200,7 +17180,7 @@ def test_remove_context_children_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_remove_context_children_rest_unset_required_fields(): @@ -17387,7 +17367,7 @@ def test_query_context_lineage_subgraph_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_context_lineage_subgraph_rest_unset_required_fields(): @@ -17574,7 +17554,7 @@ def test_create_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_execution_rest_unset_required_fields(): @@ -17766,7 +17746,7 @@ def test_get_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_execution_rest_unset_required_fields(): @@ -17955,7 +17935,7 @@ def test_list_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_executions_rest_unset_required_fields(): @@ -18215,7 +18195,7 @@ def test_update_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_execution_rest_unset_required_fields(): @@ -18412,7 +18392,7 @@ def test_delete_execution_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_execution_rest_unset_required_fields(): @@ -18598,7 +18578,7 @@ def test_purge_executions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_purge_executions_rest_unset_required_fields(): @@ -18789,7 +18769,7 @@ def test_add_execution_events_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_execution_events_rest_unset_required_fields(): @@ -18976,7 +18956,7 @@ def test_query_execution_inputs_and_outputs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_execution_inputs_and_outputs_rest_unset_required_fields(): @@ -19168,7 +19148,7 @@ def test_create_metadata_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_metadata_schema_rest_unset_required_fields(): @@ -19364,7 +19344,7 @@ def test_get_metadata_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_metadata_schema_rest_unset_required_fields(): @@ -19557,7 +19537,7 @@ def test_list_metadata_schemas_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_metadata_schemas_rest_unset_required_fields(): @@ -19823,7 +19803,7 @@ def test_query_artifact_lineage_subgraph_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_artifact_lineage_subgraph_rest_unset_required_fields(): @@ -36203,6 +36183,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MetadataServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36342,6 +36354,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MetadataServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36487,6 +36531,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36632,6 +36710,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MetadataServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36777,6 +36889,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MetadataServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36922,6 +37068,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MetadataServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37063,6 +37243,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37227,6 +37441,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37394,6 +37643,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37571,6 +37855,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MetadataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MetadataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py index 35e994e756..31de8730f6 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -140,6 +135,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert MigrationServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -162,6 +158,10 @@ def test__get_default_mtls_endpoint(): MigrationServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + MigrationServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -1904,11 +1904,7 @@ async def test_search_migratable_resources_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_migratable_resources(request={}) - ).pages: + async for page_ in (await client.search_migratable_resources(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2423,7 +2419,7 @@ def test_search_migratable_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_migratable_resources_rest_unset_required_fields(): @@ -2676,7 +2672,7 @@ def test_batch_migrate_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_migrate_resources_rest_unset_required_fields(): @@ -5597,7 +5593,7 @@ def test_parse_annotated_dataset_path(): assert expected == actual -def test_dataset_path(): +def test_auto_ml_dataset_path(): project = "cuttlefish" location = "mussel" dataset = "winkle" @@ -5606,95 +5602,95 @@ def test_dataset_path(): location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.auto_ml_dataset_path(project, location, dataset) assert expected == actual -def test_parse_dataset_path(): +def test_parse_auto_ml_dataset_path(): expected = { "project": "nautilus", "location": "scallop", "dataset": "abalone", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.auto_ml_dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_auto_ml_dataset_path(path) assert expected == actual -def test_dataset_path(): +def test_auto_ml_model_path(): project = "squid" - dataset = "clam" - expected = "projects/{project}/datasets/{dataset}".format( + location = "clam" + model = "whelk" + expected = "projects/{project}/locations/{location}/models/{model}".format( project=project, - dataset=dataset, + location=location, + model=model, ) - actual = MigrationServiceClient.dataset_path(project, dataset) + actual = MigrationServiceClient.auto_ml_model_path(project, location, model) assert expected == actual -def test_parse_dataset_path(): +def test_parse_auto_ml_model_path(): expected = { - "project": "whelk", - "dataset": "octopus", + "project": "octopus", + "location": "oyster", + "model": "nudibranch", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.auto_ml_model_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_auto_ml_model_path(path) assert expected == actual -def test_dataset_path(): - project = "oyster" - location = "nudibranch" - dataset = "cuttlefish" - expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( +def test_data_labeling_dataset_path(): + project = "cuttlefish" + dataset = "mussel" + expected = "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.data_labeling_dataset_path(project, dataset) assert expected == actual -def test_parse_dataset_path(): +def test_parse_data_labeling_dataset_path(): expected = { - "project": "mussel", - "location": "winkle", + "project": "winkle", "dataset": "nautilus", } - path = MigrationServiceClient.dataset_path(**expected) + path = MigrationServiceClient.data_labeling_dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_dataset_path(path) + actual = MigrationServiceClient.parse_data_labeling_dataset_path(path) assert expected == actual -def test_model_path(): +def test_dataset_path(): project = "scallop" location = "abalone" - model = "squid" - expected = "projects/{project}/locations/{location}/models/{model}".format( + dataset = "squid" + expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, location=location, - model=model, + dataset=dataset, ) - actual = MigrationServiceClient.model_path(project, location, model) + actual = MigrationServiceClient.dataset_path(project, location, dataset) assert expected == actual -def test_parse_model_path(): +def test_parse_dataset_path(): expected = { "project": "clam", "location": "whelk", - "model": "octopus", + "dataset": "octopus", } - path = MigrationServiceClient.model_path(**expected) + path = MigrationServiceClient.dataset_path(**expected) # Check that the path construction is reversible. - actual = MigrationServiceClient.parse_model_path(path) + actual = MigrationServiceClient.parse_dataset_path(path) assert expected == actual @@ -6015,6 +6011,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = MigrationServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6154,6 +6182,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = MigrationServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6299,6 +6359,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6444,6 +6538,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = MigrationServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6589,6 +6717,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = MigrationServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6734,6 +6896,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = MigrationServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6875,6 +7071,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7039,6 +7269,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7206,6 +7471,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7383,6 +7683,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = MigrationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = MigrationServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py index 67d5d82a99..e2d982fa13 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -148,6 +143,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ModelGardenServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -170,6 +166,10 @@ def test__get_default_mtls_endpoint(): ModelGardenServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ModelGardenServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2308,11 +2308,7 @@ async def test_list_publisher_models_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_publisher_models(request={}) - ).pages: + async for page_ in (await client.list_publisher_models(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3947,7 +3943,7 @@ def test_get_publisher_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_publisher_model_rest_unset_required_fields(): @@ -4153,7 +4149,7 @@ def test_list_publisher_models_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_publisher_models_rest_unset_required_fields(): @@ -4406,7 +4402,7 @@ def test_deploy_rest_required_fields(request_type=model_garden_service.DeployReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_rest_unset_required_fields(): @@ -4537,7 +4533,7 @@ def test_deploy_publisher_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_deploy_publisher_model_rest_unset_required_fields(): @@ -4676,7 +4672,7 @@ def test_export_publisher_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_publisher_model_rest_unset_required_fields(): @@ -4821,7 +4817,7 @@ def test_check_publisher_model_eula_acceptance_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_check_publisher_model_eula_acceptance_rest_unset_required_fields(): @@ -5027,7 +5023,7 @@ def test_accept_publisher_model_eula_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_accept_publisher_model_eula_rest_unset_required_fields(): @@ -10259,6 +10255,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ModelGardenServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10398,6 +10426,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ModelGardenServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10543,6 +10603,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10688,6 +10782,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ModelGardenServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10833,6 +10961,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ModelGardenServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10978,6 +11140,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ModelGardenServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11119,6 +11315,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11283,6 +11513,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11450,6 +11715,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11627,6 +11927,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ModelGardenServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ModelGardenServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ModelGardenServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py index 706396b602..2a51db4186 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -165,6 +160,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ModelMonitoringServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -187,6 +183,10 @@ def test__get_default_mtls_endpoint(): ModelMonitoringServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ModelMonitoringServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3092,11 +3092,7 @@ async def test_list_model_monitors_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_monitors(request={}) - ).pages: + async for page_ in (await client.list_model_monitors(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4723,11 +4719,7 @@ async def test_list_model_monitoring_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_monitoring_jobs(request={}) - ).pages: + async for page_ in (await client.list_model_monitoring_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5630,9 +5622,7 @@ async def test_search_model_monitoring_stats_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.search_model_monitoring_stats(request={}) ).pages: pages.append(page_) @@ -6202,9 +6192,7 @@ async def test_search_model_monitoring_alerts_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.search_model_monitoring_alerts(request={}) ).pages: pages.append(page_) @@ -6328,7 +6316,7 @@ def test_create_model_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_model_monitor_rest_unset_required_fields(): @@ -6529,7 +6517,7 @@ def test_update_model_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_model_monitor_rest_unset_required_fields(): @@ -6733,7 +6721,7 @@ def test_get_model_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_monitor_rest_unset_required_fields(): @@ -6928,7 +6916,7 @@ def test_list_model_monitors_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_monitors_rest_unset_required_fields(): @@ -7189,7 +7177,7 @@ def test_delete_model_monitor_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_monitor_rest_unset_required_fields(): @@ -7375,7 +7363,7 @@ def test_create_model_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_model_monitoring_job_rest_unset_required_fields(): @@ -7574,7 +7562,7 @@ def test_get_model_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_monitoring_job_rest_unset_required_fields(): @@ -7770,7 +7758,7 @@ def test_list_model_monitoring_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_monitoring_jobs_rest_unset_required_fields(): @@ -8036,7 +8024,7 @@ def test_delete_model_monitoring_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_monitoring_job_rest_unset_required_fields(): @@ -8224,7 +8212,7 @@ def test_search_model_monitoring_stats_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_model_monitoring_stats_rest_unset_required_fields(): @@ -8486,7 +8474,7 @@ def test_search_model_monitoring_alerts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_search_model_monitoring_alerts_rest_unset_required_fields(): @@ -16832,6 +16820,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ModelMonitoringServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16971,6 +16991,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ModelMonitoringServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17116,6 +17168,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ModelMonitoringServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17261,6 +17347,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ModelMonitoringServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17406,6 +17526,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ModelMonitoringServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17551,6 +17705,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ModelMonitoringServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17696,6 +17884,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ModelMonitoringServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17860,6 +18082,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ModelMonitoringServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18027,6 +18284,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ModelMonitoringServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18204,6 +18496,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ModelMonitoringServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ModelMonitoringServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ModelMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py index 2cc332f305..852f0a5945 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -158,6 +153,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ModelServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -176,6 +172,10 @@ def test__get_default_mtls_endpoint(): == sandbox_mtls_endpoint ) assert ModelServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + assert ( + ModelServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2579,11 +2579,7 @@ async def test_list_models_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_models(request={}) - ).pages: + async for page_ in (await client.list_models(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3128,11 +3124,7 @@ async def test_list_model_versions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_versions(request={}) - ).pages: + async for page_ in (await client.list_model_versions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3679,9 +3671,7 @@ async def test_list_model_version_checkpoints_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_version_checkpoints(request={}) ).pages: pages.append(page_) @@ -8245,11 +8235,7 @@ async def test_list_model_evaluations_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_model_evaluations(request={}) - ).pages: + async for page_ in (await client.list_model_evaluations(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9148,9 +9134,7 @@ async def test_list_model_evaluation_slices_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_model_evaluation_slices(request={}) ).pages: pages.append(page_) @@ -9511,7 +9495,7 @@ def test_upload_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upload_model_rest_unset_required_fields(): @@ -9695,7 +9679,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_rest_unset_required_fields(): @@ -9880,7 +9864,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_models_rest_unset_required_fields(): @@ -10143,7 +10127,7 @@ def test_list_model_versions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_versions_rest_unset_required_fields(): @@ -10409,7 +10393,7 @@ def test_list_model_version_checkpoints_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_version_checkpoints_rest_unset_required_fields(): @@ -10663,7 +10647,7 @@ def test_update_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_model_rest_unset_required_fields(): @@ -10860,7 +10844,7 @@ def test_update_explanation_dataset_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_explanation_dataset_rest_unset_required_fields(): @@ -11037,7 +11021,7 @@ def test_delete_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_rest_unset_required_fields(): @@ -11218,7 +11202,7 @@ def test_delete_model_version_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_model_version_rest_unset_required_fields(): @@ -11404,7 +11388,7 @@ def test_merge_version_aliases_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_merge_version_aliases_rest_unset_required_fields(): @@ -11594,7 +11578,7 @@ def test_export_model_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_model_rest_unset_required_fields(): @@ -11788,7 +11772,7 @@ def test_copy_model_rest_required_fields(request_type=model_service.CopyModelReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_copy_model_rest_unset_required_fields(): @@ -11980,7 +11964,7 @@ def test_import_model_evaluation_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_model_evaluation_rest_unset_required_fields(): @@ -12176,7 +12160,7 @@ def test_batch_import_model_evaluation_slices_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_import_model_evaluation_slices_rest_unset_required_fields(): @@ -12384,7 +12368,7 @@ def test_batch_import_evaluated_annotations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_import_evaluated_annotations_rest_unset_required_fields(): @@ -12592,7 +12576,7 @@ def test_get_model_evaluation_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_evaluation_rest_unset_required_fields(): @@ -12786,7 +12770,7 @@ def test_list_model_evaluations_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_evaluations_rest_unset_required_fields(): @@ -13042,7 +13026,7 @@ def test_get_model_evaluation_slice_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_model_evaluation_slice_rest_unset_required_fields(): @@ -13238,7 +13222,7 @@ def test_list_model_evaluation_slices_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_model_evaluation_slices_rest_unset_required_fields(): @@ -13500,7 +13484,7 @@ def test_recommend_spec_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_recommend_spec_rest_unset_required_fields(): @@ -24291,6 +24275,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ModelServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24430,6 +24446,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ModelServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24575,6 +24623,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24720,6 +24802,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ModelServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24865,6 +24981,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ModelServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25010,6 +25160,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ModelServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25151,6 +25335,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25315,6 +25533,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25482,6 +25735,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25659,6 +25947,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ModelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ModelServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py index 8caca7c8cc..bd73195d45 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -165,6 +160,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert NotebookServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -186,6 +182,10 @@ def test__get_default_mtls_endpoint(): assert ( NotebookServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + NotebookServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2679,9 +2679,7 @@ async def test_list_notebook_runtime_templates_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_notebook_runtime_templates(request={}) ).pages: pages.append(page_) @@ -4753,11 +4751,7 @@ async def test_list_notebook_runtimes_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_notebook_runtimes(request={}) - ).pages: + async for page_ in (await client.list_notebook_runtimes(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7454,9 +7448,7 @@ async def test_list_notebook_execution_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_notebook_execution_jobs(request={}) ).pages: pages.append(page_) @@ -7928,7 +7920,7 @@ def test_create_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_notebook_runtime_template_rest_unset_required_fields(): @@ -8127,7 +8119,7 @@ def test_get_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_runtime_template_rest_unset_required_fields(): @@ -8326,7 +8318,7 @@ def test_list_notebook_runtime_templates_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_runtime_templates_rest_unset_required_fields(): @@ -8593,7 +8585,7 @@ def test_delete_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_runtime_template_rest_unset_required_fields(): @@ -8776,7 +8768,7 @@ def test_update_notebook_runtime_template_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_notebook_runtime_template_rest_unset_required_fields(): @@ -8988,7 +8980,7 @@ def test_assign_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_assign_notebook_runtime_rest_unset_required_fields(): @@ -9183,7 +9175,7 @@ def test_get_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_runtime_rest_unset_required_fields(): @@ -9380,7 +9372,7 @@ def test_list_notebook_runtimes_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_runtimes_rest_unset_required_fields(): @@ -9638,7 +9630,7 @@ def test_delete_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_runtime_rest_unset_required_fields(): @@ -9823,7 +9815,7 @@ def test_upgrade_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upgrade_notebook_runtime_rest_unset_required_fields(): @@ -10008,7 +10000,7 @@ def test_start_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_start_notebook_runtime_rest_unset_required_fields(): @@ -10193,7 +10185,7 @@ def test_stop_notebook_runtime_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stop_notebook_runtime_rest_unset_required_fields(): @@ -10380,7 +10372,7 @@ def test_create_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_notebook_execution_job_rest_unset_required_fields(): @@ -10585,7 +10577,7 @@ def test_get_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_notebook_execution_job_rest_unset_required_fields(): @@ -10782,7 +10774,7 @@ def test_list_notebook_execution_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_notebook_execution_jobs_rest_unset_required_fields(): @@ -11045,7 +11037,7 @@ def test_delete_notebook_execution_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_notebook_execution_job_rest_unset_required_fields(): @@ -20733,6 +20725,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = NotebookServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20872,6 +20896,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = NotebookServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21017,6 +21073,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21162,6 +21252,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = NotebookServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21307,6 +21431,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = NotebookServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21452,6 +21610,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = NotebookServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21593,6 +21785,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21757,6 +21983,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21924,6 +22185,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22101,6 +22397,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = NotebookServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = NotebookServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_online_evaluator_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_online_evaluator_service.py index ba6358480f..d8538b52c3 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_online_evaluator_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_online_evaluator_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -150,6 +145,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert OnlineEvaluatorServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -172,6 +168,10 @@ def test__get_default_mtls_endpoint(): OnlineEvaluatorServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + OnlineEvaluatorServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3501,11 +3501,7 @@ async def test_list_online_evaluators_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_online_evaluators(request={}) - ).pages: + async for page_ in (await client.list_online_evaluators(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4320,7 +4316,7 @@ def test_create_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_online_evaluator_rest_unset_required_fields(): @@ -4534,7 +4530,7 @@ def test_get_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_online_evaluator_rest_unset_required_fields(): @@ -4718,7 +4714,7 @@ def test_update_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_online_evaluator_rest_unset_required_fields(): @@ -4930,7 +4926,7 @@ def test_delete_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_online_evaluator_rest_unset_required_fields(): @@ -5124,7 +5120,7 @@ def test_list_online_evaluators_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_online_evaluators_rest_unset_required_fields(): @@ -5385,7 +5381,7 @@ def test_activate_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_activate_online_evaluator_rest_unset_required_fields(): @@ -5570,7 +5566,7 @@ def test_suspend_online_evaluator_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_suspend_online_evaluator_rest_unset_required_fields(): @@ -11735,6 +11731,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = OnlineEvaluatorServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11874,6 +11902,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = OnlineEvaluatorServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12019,6 +12079,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = OnlineEvaluatorServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12164,6 +12258,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = OnlineEvaluatorServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12309,6 +12437,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = OnlineEvaluatorServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12454,6 +12616,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = OnlineEvaluatorServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12599,6 +12795,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = OnlineEvaluatorServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12763,6 +12993,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = OnlineEvaluatorServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12930,6 +13195,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = OnlineEvaluatorServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13107,6 +13407,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = OnlineEvaluatorServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = OnlineEvaluatorServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = OnlineEvaluatorServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py index d04e3f9c1c..a3b7a9da29 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -156,6 +151,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PersistentResourceServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -180,6 +176,10 @@ def test__get_default_mtls_endpoint(): PersistentResourceServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PersistentResourceServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2717,11 +2717,7 @@ async def test_list_persistent_resources_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_persistent_resources(request={}) - ).pages: + async for page_ in (await client.list_persistent_resources(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3915,7 +3911,7 @@ def test_create_persistent_resource_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_persistent_resource_rest_unset_required_fields(): @@ -4113,7 +4109,7 @@ def test_get_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_persistent_resource_rest_unset_required_fields(): @@ -4309,7 +4305,7 @@ def test_list_persistent_resources_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_persistent_resources_rest_unset_required_fields(): @@ -4569,7 +4565,7 @@ def test_delete_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_persistent_resource_rest_unset_required_fields(): @@ -4751,7 +4747,7 @@ def test_update_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_persistent_resource_rest_unset_required_fields(): @@ -4952,7 +4948,7 @@ def test_reboot_persistent_resource_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_reboot_persistent_resource_rest_unset_required_fields(): @@ -10485,6 +10481,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PersistentResourceServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10624,6 +10652,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PersistentResourceServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10769,6 +10829,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10914,6 +11008,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11059,6 +11187,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11204,6 +11366,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PersistentResourceServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11349,6 +11545,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11513,6 +11743,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11680,6 +11945,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11857,6 +12157,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PersistentResourceServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PersistentResourceServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PersistentResourceServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py index a235ca9038..81963a4867 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -168,6 +163,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PipelineServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -189,6 +185,10 @@ def test__get_default_mtls_endpoint(): assert ( PipelineServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PipelineServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2656,11 +2656,7 @@ async def test_list_training_pipelines_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_training_pipelines(request={}) - ).pages: + async for page_ in (await client.list_training_pipelines(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4661,11 +4657,7 @@ async def test_list_pipeline_jobs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_pipeline_jobs(request={}) - ).pages: + async for page_ in (await client.list_pipeline_jobs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6175,7 +6167,7 @@ def test_create_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_training_pipeline_rest_unset_required_fields(): @@ -6368,7 +6360,7 @@ def test_get_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_training_pipeline_rest_unset_required_fields(): @@ -6564,7 +6556,7 @@ def test_list_training_pipelines_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_training_pipelines_rest_unset_required_fields(): @@ -6821,7 +6813,7 @@ def test_delete_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_training_pipeline_rest_unset_required_fields(): @@ -7002,7 +6994,7 @@ def test_cancel_training_pipeline_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_training_pipeline_rest_unset_required_fields(): @@ -7187,7 +7179,7 @@ def test_create_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_pipeline_job_rest_unset_required_fields(): @@ -7379,7 +7371,7 @@ def test_get_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_pipeline_job_rest_unset_required_fields(): @@ -7573,7 +7565,7 @@ def test_list_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_pipeline_jobs_rest_unset_required_fields(): @@ -7830,7 +7822,7 @@ def test_delete_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_pipeline_job_rest_unset_required_fields(): @@ -8019,7 +8011,7 @@ def test_batch_delete_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_delete_pipeline_jobs_rest_unset_required_fields(): @@ -8207,7 +8199,7 @@ def test_cancel_pipeline_job_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_cancel_pipeline_job_rest_unset_required_fields(): @@ -8396,7 +8388,7 @@ def test_batch_cancel_pipeline_jobs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_cancel_pipeline_jobs_rest_unset_required_fields(): @@ -16627,6 +16619,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PipelineServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16766,6 +16790,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PipelineServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16911,6 +16967,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17056,6 +17146,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PipelineServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17201,6 +17325,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PipelineServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17346,6 +17504,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PipelineServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17487,6 +17679,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17651,6 +17877,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17818,6 +18079,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17995,6 +18291,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PipelineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PipelineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py index f1e0c6e8ba..3ef180e4ad 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -148,6 +143,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert PredictionServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -170,6 +166,10 @@ def test__get_default_mtls_endpoint(): PredictionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + PredictionServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -5803,7 +5803,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_predict_rest_unset_required_fields(): @@ -5994,7 +5994,7 @@ def test_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_raw_predict_rest_unset_required_fields(): @@ -6180,7 +6180,7 @@ def test_stream_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_raw_predict_rest_unset_required_fields(): @@ -6364,7 +6364,7 @@ def test_direct_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_direct_predict_rest_unset_required_fields(): @@ -6489,7 +6489,7 @@ def test_direct_raw_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_direct_raw_predict_rest_unset_required_fields(): @@ -6651,7 +6651,7 @@ def test_server_streaming_predict_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_server_streaming_predict_rest_unset_required_fields(): @@ -6781,7 +6781,7 @@ def test_explain_rest_required_fields(request_type=prediction_service.ExplainReq expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_explain_rest_unset_required_fields(): @@ -6976,7 +6976,7 @@ def test_count_tokens_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_count_tokens_rest_unset_required_fields(): @@ -7161,7 +7161,7 @@ def test_generate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_generate_content_rest_unset_required_fields(): @@ -7360,7 +7360,7 @@ def test_stream_generate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_generate_content_rest_unset_required_fields(): @@ -7557,7 +7557,7 @@ def test_chat_completions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_chat_completions_rest_unset_required_fields(): @@ -15032,6 +15032,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = PredictionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15171,6 +15203,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = PredictionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15316,6 +15380,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15461,6 +15559,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = PredictionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15606,6 +15738,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = PredictionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15751,6 +15917,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = PredictionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15892,6 +16092,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16056,6 +16290,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16223,6 +16492,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16400,6 +16704,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = PredictionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py index 6f95c89654..1e674d163a 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -143,6 +138,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ( ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint(None) is None @@ -173,6 +169,12 @@ def test__get_default_mtls_endpoint(): ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ReasoningEngineExecutionServiceClient._get_default_mtls_endpoint( + custom_endpoint + ) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2249,6 +2251,279 @@ async def test_async_query_reasoning_engine_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +def test_cancel_async_query_reasoning_engine(request_type, transport: str = "grpc"): + client = ReasoningEngineExecutionServiceClient( + 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.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + response = client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +def test_cancel_async_query_reasoning_engine_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client.cancel_async_query_reasoning_engine(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[ + 0 + ] == reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest( + name="name_value", + operation_name="operation_name_value", + ) + + +def test_cancel_async_query_reasoning_engine_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.cancel_async_query_reasoning_engine + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + request = {} + client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async_use_cached_wrapped_rpc( + transport: str = "grpc_asyncio", +): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._client._transport.cancel_async_query_reasoning_engine + in client._client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[ + client._client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + + request = {} + await client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async( + transport: str = "grpc_asyncio", + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + response = await client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_async_from_dict(): + await test_cancel_async_query_reasoning_engine_async(request_type=dict) + + +def test_cancel_async_query_reasoning_engine_field_headers(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + client.cancel_async_query_reasoning_engine(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_cancel_async_query_reasoning_engine_field_headers_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + await client.cancel_async_query_reasoning_engine(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_query_reasoning_engine_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2367,7 +2642,7 @@ def test_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_query_reasoning_engine_rest_unset_required_fields(): @@ -2494,7 +2769,7 @@ def test_stream_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stream_query_reasoning_engine_rest_unset_required_fields(): @@ -2623,7 +2898,7 @@ def test_async_query_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_async_query_reasoning_engine_rest_unset_required_fields(): @@ -2635,29 +2910,173 @@ def test_async_query_reasoning_engine_rest_unset_required_fields(): assert set(unset_fields) == (set(()) & set(("name",))) -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): +def test_cancel_async_query_reasoning_engine_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + transport="rest", ) - # It is an error to provide a credentials file and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ReasoningEngineExecutionServiceClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() - # It is an error to provide an api_key and a transport instance. - transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + # Ensure method has been cached + assert ( + client._transport.cancel_async_query_reasoning_engine + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.cancel_async_query_reasoning_engine + ] = mock_rpc + + request = {} + client.cancel_async_query_reasoning_engine(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_async_query_reasoning_engine(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_cancel_async_query_reasoning_engine_rest_required_fields( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + transport_class = transports.ReasoningEngineExecutionServiceRestTransport + + request_init = {} + request_init["name"] = "" + request_init["operation_name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson(pb_request, use_integers_for_enums=False) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).cancel_async_query_reasoning_engine._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + jsonified_request["operationName"] = "operation_name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).cancel_async_query_reasoning_engine._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + assert "operationName" in jsonified_request + assert jsonified_request["operationName"] == "operation_name_value" + + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.cancel_async_query_reasoning_engine(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert sorted(expected_params) == sorted(actual_params) + + +def test_cancel_async_query_reasoning_engine_rest_unset_required_fields(): + transport = transports.ReasoningEngineExecutionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = ( + transport.cancel_async_query_reasoning_engine._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "name", + "operationName", + ) + ) + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineExecutionServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.ReasoningEngineExecutionServiceGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() @@ -2816,6 +3235,33 @@ def test_async_query_reasoning_engine_empty_call_grpc(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_async_query_reasoning_engine_empty_call_grpc(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_transport_kind_grpc_asyncio(): transport = ReasoningEngineExecutionServiceAsyncClient.get_transport_class( "grpc_asyncio" @@ -2914,6 +3360,35 @@ async def test_async_query_reasoning_engine_empty_call_grpc_asyncio(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_empty_call_grpc_asyncio(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + await client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_transport_kind_rest(): transport = ReasoningEngineExecutionServiceClient.get_transport_class("rest")( credentials=ga_credentials.AnonymousCredentials() @@ -3328,10 +3803,159 @@ def test_async_query_reasoning_engine_rest_interceptors(null_interceptor): ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - post_with_metadata.return_value = operations_pb2.Operation(), metadata + post.return_value = operations_pb2.Operation() + post_with_metadata.return_value = operations_pb2.Operation(), metadata + + client.async_query_reasoning_engine( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +def test_cancel_async_query_reasoning_engine_rest_bad_request( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.cancel_async_query_reasoning_engine(request) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +def test_cancel_async_query_reasoning_engine_rest_call_success(request_type): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.cancel_async_query_reasoning_engine(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_cancel_async_query_reasoning_engine_rest_interceptors(null_interceptor): + transport = transports.ReasoningEngineExecutionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=( + None + if null_interceptor + else transports.ReasoningEngineExecutionServiceRestInterceptor() + ), + ) + client = ReasoningEngineExecutionServiceClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine", + ) as post, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.ReasoningEngineExecutionServiceRestInterceptor, + "pre_cancel_async_query_reasoning_engine", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + req.return_value.content = return_value + + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse(), + metadata, + ) - client.async_query_reasoning_engine( + client.cancel_async_query_reasoning_engine( request, metadata=[ ("key", "val"), @@ -4046,6 +4670,30 @@ def test_async_query_reasoning_engine_empty_call_rest(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_async_query_reasoning_engine_empty_call_rest(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_reasoning_engine_execution_service_rest_lro_client(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4545,6 +5193,175 @@ async def test_async_query_reasoning_engine_rest_asyncio_interceptors(null_inter post_with_metadata.assert_called_once() +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_rest_asyncio_bad_request( + request_type=reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.cancel_async_query_reasoning_engine(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest, + dict, + ], +) +async def test_cancel_async_query_reasoning_engine_rest_asyncio_call_success( + request_type, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = await client.cancel_async_query_reasoning_engine(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse, + ) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("null_interceptor", [True, False]) +async def test_cancel_async_query_reasoning_engine_rest_asyncio_interceptors( + null_interceptor, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = transports.AsyncReasoningEngineExecutionServiceRestTransport( + credentials=async_anonymous_credentials(), + interceptor=( + None + if null_interceptor + else transports.AsyncReasoningEngineExecutionServiceRestInterceptor() + ), + ) + client = ReasoningEngineExecutionServiceAsyncClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine", + ) as post, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "post_cancel_async_query_reasoning_engine_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.AsyncReasoningEngineExecutionServiceRestInterceptor, + "pre_cancel_async_query_reasoning_engine", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest.pb( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse.to_json( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + req.return_value.read = mock.AsyncMock(return_value=return_value) + + request = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineResponse(), + metadata, + ) + + await client.cancel_async_query_reasoning_engine( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + @pytest.mark.asyncio async def test_get_location_rest_asyncio_bad_request( request_type=locations_pb2.GetLocationRequest, @@ -5378,6 +6195,35 @@ async def test_async_query_reasoning_engine_empty_call_rest_asyncio(): assert args[0] == request_msg +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_async_query_reasoning_engine_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_async_query_reasoning_engine), "__call__" + ) as call: + await client.cancel_async_query_reasoning_engine(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_execution_service.CancelAsyncQueryReasoningEngineRequest() + ) + + assert args[0] == request_msg + + def test_reasoning_engine_execution_service_rest_asyncio_lro_client(): if not HAS_ASYNC_REST_EXTRA: pytest.skip( @@ -5449,6 +6295,7 @@ def test_reasoning_engine_execution_service_base_transport(): "query_reasoning_engine", "stream_query_reasoning_engine", "async_query_reasoning_engine", + "cancel_async_query_reasoning_engine", "set_iam_policy", "get_iam_policy", "test_iam_permissions", @@ -5742,6 +6589,9 @@ def test_reasoning_engine_execution_service_client_transport_session_collision( session1 = client1.transport.async_query_reasoning_engine._session session2 = client2.transport.async_query_reasoning_engine._session assert session1 != session2 + session1 = client1.transport.cancel_async_query_reasoning_engine._session + session2 = client2.transport.cancel_async_query_reasoning_engine._session + assert session1 != session2 def test_reasoning_engine_execution_service_grpc_transport_channel(): @@ -6208,6 +7058,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6313,7 +7195,41 @@ async def test_cancel_operation_field_headers_async(): ) in kw["metadata"] -def test_cancel_operation_from_dict(): +def test_cancel_operation_from_dict(): + client = ReasoningEngineExecutionServiceClient( + 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 = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_cancel_operation_flattened(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6322,16 +7238,15 @@ def test_cancel_operation_from_dict(): # Designate an appropriate return value for the call. call.return_value = None - response = client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() @pytest.mark.asyncio -async def test_cancel_operation_from_dict_async(): +async def test_cancel_operation_flattened_async(): client = ReasoningEngineExecutionServiceAsyncClient( credentials=async_anonymous_credentials(), ) @@ -6339,12 +7254,11 @@ async def test_cancel_operation_from_dict_async(): 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() + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() def test_wait_operation(transport: str = "grpc"): @@ -6492,6 +7406,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6637,6 +7585,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6782,6 +7764,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6927,6 +7943,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ReasoningEngineExecutionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7072,6 +8122,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7236,6 +8320,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7403,6 +8522,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7580,6 +8734,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ReasoningEngineExecutionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ReasoningEngineExecutionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ReasoningEngineExecutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_runtime_revision_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_runtime_revision_service.py new file mode 100644 index 0000000000..443dd5538b --- /dev/null +++ b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_runtime_revision_service.py @@ -0,0 +1,9050 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 +from unittest import mock +from unittest.mock import AsyncMock + +import grpc +from grpc.experimental import aio +from collections.abc import Iterable, AsyncIterable +from google.protobuf import json_format +import json +import math +import pytest +from collections.abc import Sequence, Mapping +from google.api_core import api_core_version +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +try: + import aiohttp # type: ignore + from google.auth.aio.transport.sessions import AsyncAuthorizedSession + from google.api_core.operations_v1 import AsyncOperationsRestClient + + HAS_ASYNC_REST_EXTRA = True +except ImportError: # pragma: NO COVER + HAS_ASYNC_REST_EXTRA = False +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session +from google.protobuf import json_format + +try: + from google.auth.aio import credentials as ga_credentials_async + + HAS_GOOGLE_AUTH_AIO = True +except ImportError: # pragma: NO COVER + HAS_GOOGLE_AUTH_AIO = False + +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 operations_v1 +from google.api_core import path_template +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, +) +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + ReasoningEngineRuntimeRevisionServiceClient, +) +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + pagers, +) +from google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service import ( + transports, +) +from google.cloud.aiplatform_v1beta1.types import reasoning_engine +from google.cloud.aiplatform_v1beta1.types import reasoning_engine_runtime_revision +from google.cloud.aiplatform_v1beta1.types import ( + reasoning_engine_runtime_revision_service, +) +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 # type: ignore +from google.oauth2 import service_account +import google.api_core.operation_async as operation_async # type: ignore +import google.auth +import google.protobuf.empty_pb2 as empty_pb2 # type: ignore +import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore + + +CRED_INFO_JSON = { + "credential_source": "/path/to/file", + "credential_type": "service account credentials", + "principal": "service-account@example.com", +} +CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) + + +async def mock_async_gen(data, chunk_size=1): + for i in range(0, len(data)): # pragma: NO COVER + chunk = data[i : i + chunk_size] + yield chunk.encode("utf-8") + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# TODO: use async auth anon credentials by default once the minimum version of google-auth is upgraded. +# See related issue: https://github.com/googleapis/gapic-generator-python/issues/2107. +def async_anonymous_credentials(): + if HAS_GOOGLE_AUTH_AIO: + return ga_credentials_async.AnonymousCredentials() + return ga_credentials.AnonymousCredentials() + + +# 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 + ) + + +# If default endpoint template is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint template so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint_template(client): + return ( + "test.{UNIVERSE_DOMAIN}" + if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) + else client._DEFAULT_ENDPOINT_TEMPLATE + ) + + +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" + custom_endpoint = ".custom" + + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint(None) + is None + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + api_endpoint + ) + == api_mtls_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + api_mtls_endpoint + ) + == api_mtls_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + sandbox_endpoint + ) + == sandbox_mtls_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + sandbox_mtls_endpoint + ) + == sandbox_mtls_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + non_googleapi + ) + == non_googleapi + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_default_mtls_endpoint( + custom_endpoint + ) + == custom_endpoint + ) + + +def test__read_environment_variables(): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "auto", None) + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (True, "auto", None) + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "auto", None) + ) + + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with pytest.raises(ValueError) as excinfo: + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + else: + assert ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() == ( + False, + "auto", + None, + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "never", None) + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "always", None) + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "auto", None) + ) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError) as excinfo: + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._read_environment_variables() + == (False, "auto", "foo.com") + ) + + +def test_use_client_cert_effective(): + # Test case 1: Test when `should_use_client_cert` returns True. + # We mock the `should_use_client_cert` function to simulate a scenario where + # the google-auth library supports automatic mTLS and determines that a + # client certificate should be used. + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch( + "google.auth.transport.mtls.should_use_client_cert", return_value=True + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is True + ) + + # Test case 2: Test when `should_use_client_cert` returns False. + # We mock the `should_use_client_cert` function to simulate a scenario where + # the google-auth library supports automatic mTLS and determines that a + # client certificate should NOT be used. + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch( + "google.auth.transport.mtls.should_use_client_cert", return_value=False + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 3: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "true". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is True + ) + + # Test case 4: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "false". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"} + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 5: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "True". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "True"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is True + ) + + # Test case 6: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "False". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "False"} + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 7: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "TRUE". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "TRUE"}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is True + ) + + # Test case 8: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to "FALSE". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "FALSE"} + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 9: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not set. + # In this case, the method should return False, which is the default value. + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict(os.environ, clear=True): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 10: Test when `should_use_client_cert` is unavailable and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to an invalid value. + # The method should raise a ValueError as the environment variable must be either + # "true" or "false". + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "unsupported"} + ): + with pytest.raises(ValueError): + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + + # Test case 11: Test when `should_use_client_cert` is available and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to an invalid value. + # The method should return False as the environment variable is set to an invalid value. + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "unsupported"} + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + # Test case 12: Test when `should_use_client_cert` is available and the + # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is unset. Also, + # the GOOGLE_API_CONFIG environment variable is unset. + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": ""}): + with mock.patch.dict(os.environ, {"GOOGLE_API_CERTIFICATE_CONFIG": ""}): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._use_client_cert_effective() + is False + ) + + +def test__get_client_cert_source(): + mock_provided_cert_source = mock.Mock() + mock_default_cert_source = mock.Mock() + + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source(None, False) + is None + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source( + mock_provided_cert_source, False + ) + is None + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source( + mock_provided_cert_source, True + ) + == mock_provided_cert_source + ) + + 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_default_cert_source, + ): + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source( + None, True + ) + is mock_default_cert_source + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_client_cert_source( + mock_provided_cert_source, "true" + ) + is mock_provided_cert_source + ) + + +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceClient), +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceAsyncClient), +) +def test__get_api_endpoint(): + api_override = "foo.com" + mock_client_cert_source = mock.Mock() + default_universe = ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + default_endpoint = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format( + UNIVERSE_DOMAIN=default_universe + ) + ) + mock_universe = "bar.com" + mock_endpoint = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format( + UNIVERSE_DOMAIN=mock_universe + ) + ) + + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + api_override, mock_client_cert_source, default_universe, "always" + ) + == api_override + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, mock_client_cert_source, default_universe, "auto" + ) + == ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_MTLS_ENDPOINT + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, None, default_universe, "auto" + ) + == default_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, None, default_universe, "always" + ) + == ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_MTLS_ENDPOINT + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, mock_client_cert_source, default_universe, "always" + ) + == ReasoningEngineRuntimeRevisionServiceClient.DEFAULT_MTLS_ENDPOINT + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, None, mock_universe, "never" + ) + == mock_endpoint + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, None, default_universe, "never" + ) + == default_endpoint + ) + + with pytest.raises(MutualTLSChannelError) as excinfo: + ReasoningEngineRuntimeRevisionServiceClient._get_api_endpoint( + None, mock_client_cert_source, mock_universe, "auto" + ) + assert ( + str(excinfo.value) + == "mTLS is not supported in any universe other than googleapis.com." + ) + + +def test__get_universe_domain(): + client_universe_domain = "foo.com" + universe_domain_env = "bar.com" + + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_universe_domain( + client_universe_domain, universe_domain_env + ) + == client_universe_domain + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_universe_domain( + None, universe_domain_env + ) + == universe_domain_env + ) + assert ( + ReasoningEngineRuntimeRevisionServiceClient._get_universe_domain(None, None) + == ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + ) + + with pytest.raises(ValueError) as excinfo: + ReasoningEngineRuntimeRevisionServiceClient._get_universe_domain("", None) + assert str(excinfo.value) == "Universe Domain cannot be an empty string." + + +@pytest.mark.parametrize( + "error_code,cred_info_json,show_cred_info", + [ + (401, CRED_INFO_JSON, True), + (403, CRED_INFO_JSON, True), + (404, CRED_INFO_JSON, True), + (500, CRED_INFO_JSON, False), + (401, None, False), + (403, None, False), + (404, None, False), + (500, None, False), + ], +) +def test__add_cred_info_for_auth_errors(error_code, cred_info_json, show_cred_info): + cred = mock.Mock(["get_cred_info"]) + cred.get_cred_info = mock.Mock(return_value=cred_info_json) + client = ReasoningEngineRuntimeRevisionServiceClient(credentials=cred) + client._transport._credentials = cred + + error = core_exceptions.GoogleAPICallError("message", details=["foo"]) + error.code = error_code + + client._add_cred_info_for_auth_errors(error) + if show_cred_info: + assert error.details == ["foo", CRED_INFO_STRING] + else: + assert error.details == ["foo"] + + +@pytest.mark.parametrize("error_code", [401, 403, 404, 500]) +def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): + cred = mock.Mock([]) + assert not hasattr(cred, "get_cred_info") + client = ReasoningEngineRuntimeRevisionServiceClient(credentials=cred) + client._transport._credentials = cred + + error = core_exceptions.GoogleAPICallError("message", details=[]) + error.code = error_code + + client._add_cred_info_for_auth_errors(error) + assert error.details == [] + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ReasoningEngineRuntimeRevisionServiceClient, "grpc"), + (ReasoningEngineRuntimeRevisionServiceAsyncClient, "grpc_asyncio"), + (ReasoningEngineRuntimeRevisionServiceClient, "rest"), + ], +) +def test_reasoning_engine_runtime_revision_service_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 == ( + "aiplatform.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://aiplatform.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, "grpc"), + ( + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + (transports.ReasoningEngineRuntimeRevisionServiceRestTransport, "rest"), + ], +) +def test_reasoning_engine_runtime_revision_service_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", + [ + (ReasoningEngineRuntimeRevisionServiceClient, "grpc"), + (ReasoningEngineRuntimeRevisionServiceAsyncClient, "grpc_asyncio"), + (ReasoningEngineRuntimeRevisionServiceClient, "rest"), + ], +) +def test_reasoning_engine_runtime_revision_service_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 == ( + "aiplatform.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://aiplatform.googleapis.com" + ) + + +def test_reasoning_engine_runtime_revision_service_client_get_transport_class(): + transport = ReasoningEngineRuntimeRevisionServiceClient.get_transport_class() + available_transports = [ + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + ] + assert transport in available_transports + + transport = ReasoningEngineRuntimeRevisionServiceClient.get_transport_class("grpc") + assert transport == transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + "rest", + ), + ], +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceClient), +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceAsyncClient), +) +def test_reasoning_engine_runtime_revision_service_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( + ReasoningEngineRuntimeRevisionServiceClient, "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( + ReasoningEngineRuntimeRevisionServiceClient, "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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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) as excinfo: + client = client_class(transport=transport_name) + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # 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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + "true", + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + "true", + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + "false", + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + "false", + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + "rest", + "true", + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + "rest", + "false", + ), + ], +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceClient), +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceAsyncClient), +) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_reasoning_engine_runtime_revision_service_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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ) + 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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ) + 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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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", + [ + ReasoningEngineRuntimeRevisionServiceClient, + ReasoningEngineRuntimeRevisionServiceAsyncClient, + ], +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ReasoningEngineRuntimeRevisionServiceClient), +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ReasoningEngineRuntimeRevisionServiceAsyncClient), +) +def test_reasoning_engine_runtime_revision_service_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_CLIENT_CERTIFICATE is "Unsupported". + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + 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 cases for mTLS enablement when GOOGLE_API_USE_CLIENT_CERTIFICATE is unset. + test_cases = [ + ( + # With workloads present in config, mTLS is enabled. + { + "version": 1, + "cert_configs": { + "workload": { + "cert_path": "path/to/cert/file", + "key_path": "path/to/key/file", + } + }, + }, + mock_client_cert_source, + ), + ( + # With workloads not present in config, mTLS is disabled. + { + "version": 1, + "cert_configs": {}, + }, + None, + ), + ] + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + for config_data, expected_cert_source in test_cases: + env = os.environ.copy() + env.pop("GOOGLE_API_USE_CLIENT_CERTIFICATE", None) + with mock.patch.dict(os.environ, env, clear=True): + config_filename = "mock_certificate_config.json" + config_file_content = json.dumps(config_data) + m = mock.mock_open(read_data=config_file_content) + with mock.patch("builtins.open", m): + with mock.patch.dict( + os.environ, {"GOOGLE_API_CERTIFICATE_CONFIG": config_filename} + ): + 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 expected_cert_source + + # Test cases for mTLS enablement when GOOGLE_API_USE_CLIENT_CERTIFICATE is unset(empty). + test_cases = [ + ( + # With workloads present in config, mTLS is enabled. + { + "version": 1, + "cert_configs": { + "workload": { + "cert_path": "path/to/cert/file", + "key_path": "path/to/key/file", + } + }, + }, + mock_client_cert_source, + ), + ( + # With workloads not present in config, mTLS is disabled. + { + "version": 1, + "cert_configs": {}, + }, + None, + ), + ] + if hasattr(google.auth.transport.mtls, "should_use_client_cert"): + for config_data, expected_cert_source in test_cases: + env = os.environ.copy() + env.pop("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") + with mock.patch.dict(os.environ, env, clear=True): + config_filename = "mock_certificate_config.json" + config_file_content = json.dumps(config_data) + m = mock.mock_open(read_data=config_file_content) + with mock.patch("builtins.open", m): + with mock.patch.dict( + os.environ, {"GOOGLE_API_CERTIFICATE_CONFIG": config_filename} + ): + 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 expected_cert_source + + # 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 + + # 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) as excinfo: + client_class.get_mtls_endpoint_and_cert_source() + + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + +@pytest.mark.parametrize( + "client_class", + [ + ReasoningEngineRuntimeRevisionServiceClient, + ReasoningEngineRuntimeRevisionServiceAsyncClient, + ], +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceClient), +) +@mock.patch.object( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + "_DEFAULT_ENDPOINT_TEMPLATE", + modify_default_endpoint_template(ReasoningEngineRuntimeRevisionServiceAsyncClient), +) +def test_reasoning_engine_runtime_revision_service_client_client_api_endpoint( + client_class, +): + mock_client_cert_source = client_cert_source_callback + api_override = "foo.com" + default_universe = ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_UNIVERSE + default_endpoint = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format( + UNIVERSE_DOMAIN=default_universe + ) + ) + mock_universe = "bar.com" + mock_endpoint = ( + ReasoningEngineRuntimeRevisionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format( + UNIVERSE_DOMAIN=mock_universe + ) + ) + + # If ClientOptions.api_endpoint is set and GOOGLE_API_USE_CLIENT_CERTIFICATE="true", + # use ClientOptions.api_endpoint as the api endpoint regardless. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ): + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=api_override + ) + client = client_class( + client_options=options, + credentials=ga_credentials.AnonymousCredentials(), + ) + assert client.api_endpoint == api_override + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == default_endpoint + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", + # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + + # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), + # GOOGLE_API_USE_CLIENT_CERTIFICATE="false" (default), default cert source doesn't exist, + # and ClientOptions.universe_domain="bar.com", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with universe domain as the api endpoint. + options = client_options.ClientOptions() + universe_exists = hasattr(options, "universe_domain") + if universe_exists: + options = client_options.ClientOptions(universe_domain=mock_universe) + client = client_class( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + else: + client = client_class( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + assert client.api_endpoint == ( + mock_endpoint if universe_exists else default_endpoint + ) + assert client.universe_domain == ( + mock_universe if universe_exists else default_universe + ) + + # If ClientOptions does not have a universe domain attribute and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + options = client_options.ClientOptions() + if hasattr(options, "universe_domain"): + delattr(options, "universe_domain") + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + assert client.api_endpoint == default_endpoint + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + "rest", + ), + ], +) +def test_reasoning_engine_runtime_revision_service_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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + "rest", + None, + ), + ], +) +def test_reasoning_engine_runtime_revision_service_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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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_reasoning_engine_runtime_revision_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = ReasoningEngineRuntimeRevisionServiceClient( + 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", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_reasoning_engine_runtime_revision_service_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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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( + "aiplatform.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="aiplatform.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +def test_get_reasoning_engine_runtime_revision(request_type, transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision( + name="name_value", + state=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE, + ) + response = client.get_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + assert response.name == "name_value" + assert ( + response.state + == reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE + ) + + +def test_get_reasoning_engine_runtime_revision_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client.get_reasoning_engine_runtime_revision(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[ + 0 + ] == reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + +def test_get_reasoning_engine_runtime_revision_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.get_reasoning_engine_runtime_revision + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.get_reasoning_engine_runtime_revision + ] = mock_rpc + request = {} + client.get_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_async_use_cached_wrapped_rpc( + transport: str = "grpc_asyncio", +): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._client._transport.get_reasoning_engine_runtime_revision + in client._client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[ + client._client._transport.get_reasoning_engine_runtime_revision + ] = mock_rpc + + request = {} + await client.get_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_async( + transport: str = "grpc_asyncio", + request_type=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, +): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision( + name="name_value", + state=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE, + ) + ) + response = await client.get_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance( + response, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + assert response.name == "name_value" + assert ( + response.state + == reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE + ) + + +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_async_from_dict(): + await test_get_reasoning_engine_runtime_revision_async(request_type=dict) + + +def test_get_reasoning_engine_runtime_revision_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + client.get_reasoning_engine_runtime_revision(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_reasoning_engine_runtime_revision_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + await client.get_reasoning_engine_runtime_revision(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_reasoning_engine_runtime_revision_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_reasoning_engine_runtime_revision( + 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_reasoning_engine_runtime_revision_flattened_error(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_reasoning_engine_runtime_revision( + 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_reasoning_engine_runtime_revision_flattened_error_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + dict, + ], +) +def test_list_reasoning_engine_runtime_revisions(request_type, transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReasoningEngineRuntimeRevisionsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_reasoning_engine_runtime_revisions_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + filter="filter_value", + page_token="page_token_value", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + call.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client.list_reasoning_engine_runtime_revisions(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[ + 0 + ] == reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest( + parent="parent_value", + filter="filter_value", + page_token="page_token_value", + ) + + +def test_list_reasoning_engine_runtime_revisions_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.list_reasoning_engine_runtime_revisions + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.list_reasoning_engine_runtime_revisions + ] = mock_rpc + request = {} + client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_reasoning_engine_runtime_revisions(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_async_use_cached_wrapped_rpc( + transport: str = "grpc_asyncio", +): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._client._transport.list_reasoning_engine_runtime_revisions + in client._client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[ + client._client._transport.list_reasoning_engine_runtime_revisions + ] = mock_rpc + + request = {} + await client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_reasoning_engine_runtime_revisions(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_async( + transport: str = "grpc_asyncio", + request_type=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, +): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReasoningEngineRuntimeRevisionsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_async_from_dict(): + await test_list_reasoning_engine_runtime_revisions_async(request_type=dict) + + +def test_list_reasoning_engine_runtime_revisions_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + client.list_reasoning_engine_runtime_revisions(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_reasoning_engine_runtime_revisions_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + await client.list_reasoning_engine_runtime_revisions(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_reasoning_engine_runtime_revisions_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_reasoning_engine_runtime_revisions( + 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_reasoning_engine_runtime_revisions_flattened_error(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revisions( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_reasoning_engine_runtime_revisions( + 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_reasoning_engine_runtime_revisions_flattened_error_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_reasoning_engine_runtime_revisions( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest(), + parent="parent_value", + ) + + +def test_list_reasoning_engine_runtime_revisions_pager(transport_name: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="abc", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[], + next_page_token="def", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="ghi", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + ), + RuntimeError, + ) + + expected_metadata = () + retry = retries.Retry() + timeout = 5 + expected_metadata = tuple(expected_metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_reasoning_engine_runtime_revisions( + request={}, retry=retry, timeout=timeout + ) + + assert pager._metadata == expected_metadata + assert pager._retry == retry + assert pager._timeout == timeout + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance( + i, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + for i in results + ) + + +def test_list_reasoning_engine_runtime_revisions_pages(transport_name: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="abc", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[], + next_page_token="def", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="ghi", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + ), + RuntimeError, + ) + pages = list(client.list_reasoning_engine_runtime_revisions(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_reasoning_engine_runtime_revisions_async_pager(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="abc", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[], + next_page_token="def", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="ghi", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_reasoning_engine_runtime_revisions( + 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, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_async_pages(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="abc", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[], + next_page_token="def", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="ghi", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_reasoning_engine_runtime_revisions(request={}) + ).pages: + 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", + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +def test_delete_reasoning_engine_runtime_revision( + request_type, transport: str = "grpc" +): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_reasoning_engine_runtime_revision_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client.delete_reasoning_engine_runtime_revision(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[ + 0 + ] == reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest( + name="name_value", + ) + + +def test_delete_reasoning_engine_runtime_revision_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.delete_reasoning_engine_runtime_revision + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.delete_reasoning_engine_runtime_revision + ] = mock_rpc + request = {} + client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + # Operation methods call wrapper_fn to build a cached + # client._transport.operations_client instance on first rpc call. + # Subsequent calls should use the cached wrapper + wrapper_fn.reset_mock() + + client.delete_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_async_use_cached_wrapped_rpc( + transport: str = "grpc_asyncio", +): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._client._transport.delete_reasoning_engine_runtime_revision + in client._client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[ + client._client._transport.delete_reasoning_engine_runtime_revision + ] = mock_rpc + + request = {} + await client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + # Operation methods call wrapper_fn to build a cached + # client._transport.operations_client instance on first rpc call. + # Subsequent calls should use the cached wrapper + wrapper_fn.reset_mock() + + await client.delete_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_async( + transport: str = "grpc_asyncio", + request_type=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, +): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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_reasoning_engine_runtime_revision), "__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_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_async_from_dict(): + await test_delete_reasoning_engine_runtime_revision_async(request_type=dict) + + +def test_delete_reasoning_engine_runtime_revision_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.delete_reasoning_engine_runtime_revision(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_reasoning_engine_runtime_revision_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.delete_reasoning_engine_runtime_revision(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_reasoning_engine_runtime_revision_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__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_reasoning_engine_runtime_revision( + 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_reasoning_engine_runtime_revision_flattened_error(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__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_reasoning_engine_runtime_revision( + 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_reasoning_engine_runtime_revision_flattened_error_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +def test_get_reasoning_engine_runtime_revision_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.get_reasoning_engine_runtime_revision + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.get_reasoning_engine_runtime_revision + ] = mock_rpc + + request = {} + client.get_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_get_reasoning_engine_runtime_revision_rest_required_fields( + request_type=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, +): + transport_class = transports.ReasoningEngineRuntimeRevisionServiceRestTransport + + request_init = {} + request_init["name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson(pb_request, use_integers_for_enums=False) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_reasoning_engine_runtime_revision._get_unset_required_fields( + jsonified_request + ) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_reasoning_engine_runtime_revision._get_unset_required_fields( + jsonified_request + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.get_reasoning_engine_runtime_revision(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert sorted(expected_params) == sorted(actual_params) + + +def test_get_reasoning_engine_runtime_revision_rest_unset_required_fields(): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = ( + transport.get_reasoning_engine_runtime_revision._get_unset_required_fields({}) + ) + assert set(unset_fields) == (set(()) & set(("name",))) + + +def test_get_reasoning_engine_runtime_revision_rest_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + + # get arguments that satisfy an http rule for this method + sample_request = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.get_reasoning_engine_runtime_revision(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}" + % client.transport._host, + args[1], + ) + + +def test_get_reasoning_engine_runtime_revision_rest_flattened_error( + transport: str = "rest", +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +def test_list_reasoning_engine_runtime_revisions_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.list_reasoning_engine_runtime_revisions + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.list_reasoning_engine_runtime_revisions + ] = mock_rpc + + request = {} + client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_reasoning_engine_runtime_revisions(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_reasoning_engine_runtime_revisions_rest_required_fields( + request_type=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, +): + transport_class = transports.ReasoningEngineRuntimeRevisionServiceRestTransport + + request_init = {} + request_init["parent"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson(pb_request, use_integers_for_enums=False) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list_reasoning_engine_runtime_revisions._get_unset_required_fields( + jsonified_request + ) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["parent"] = "parent_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list_reasoning_engine_runtime_revisions._get_unset_required_fields( + jsonified_request + ) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "page_size", + "page_token", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" + + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.list_reasoning_engine_runtime_revisions(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert sorted(expected_params) == sorted(actual_params) + + +def test_list_reasoning_engine_runtime_revisions_rest_unset_required_fields(): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = ( + transport.list_reasoning_engine_runtime_revisions._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set( + ( + "filter", + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) + + +def test_list_reasoning_engine_runtime_revisions_rest_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + + # get arguments that satisfy an http rule for this method + sample_request = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.list_reasoning_engine_runtime_revisions(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1beta1/{parent=projects/*/locations/*/reasoningEngines/*}/runtimeRevisions" + % client.transport._host, + args[1], + ) + + +def test_list_reasoning_engine_runtime_revisions_rest_flattened_error( + transport: str = "rest", +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_reasoning_engine_runtime_revisions( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest(), + parent="parent_value", + ) + + +def test_list_reasoning_engine_runtime_revisions_rest_pager(transport: str = "rest"): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="abc", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[], + next_page_token="def", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + next_page_token="ghi", + ), + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + reasoning_engine_runtime_revisions=[ + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.to_json( + x + ) + for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + + pager = client.list_reasoning_engine_runtime_revisions(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance( + i, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + for i in results + ) + + pages = list( + client.list_reasoning_engine_runtime_revisions(request=sample_request).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_delete_reasoning_engine_runtime_revision_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert ( + client._transport.delete_reasoning_engine_runtime_revision + in client._transport._wrapped_methods + ) + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = ( + "foo" # operation_request.operation in compute client(s) expect a string. + ) + client._transport._wrapped_methods[ + client._transport.delete_reasoning_engine_runtime_revision + ] = mock_rpc + + request = {} + client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + # Operation methods build a cached wrapper on first rpc call + # subsequent calls should use the cached wrapper + wrapper_fn.reset_mock() + + client.delete_reasoning_engine_runtime_revision(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_delete_reasoning_engine_runtime_revision_rest_required_fields( + request_type=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, +): + transport_class = transports.ReasoningEngineRuntimeRevisionServiceRestTransport + + request_init = {} + request_init["name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson(pb_request, use_integers_for_enums=False) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete_reasoning_engine_runtime_revision._get_unset_required_fields( + jsonified_request + ) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete_reasoning_engine_runtime_revision._get_unset_required_fields( + jsonified_request + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.delete_reasoning_engine_runtime_revision(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert sorted(expected_params) == sorted(actual_params) + + +def test_delete_reasoning_engine_runtime_revision_rest_unset_required_fields(): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = ( + transport.delete_reasoning_engine_runtime_revision._get_unset_required_fields( + {} + ) + ) + assert set(unset_fields) == (set(()) & set(("name",))) + + +def test_delete_reasoning_engine_runtime_revision_rest_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # get arguments that satisfy an http rule for this method + sample_request = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.delete_reasoning_engine_runtime_revision(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1beta1/{name=projects/*/locations/*/reasoningEngines/*/runtimeRevisions/*}" + % client.transport._host, + args[1], + ) + + +def test_delete_reasoning_engine_runtime_revision_rest_flattened_error( + transport: str = "rest", +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_reasoning_engine_runtime_revision( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest(), + name="name_value", + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineRuntimeRevisionServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ReasoningEngineRuntimeRevisionServiceClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ReasoningEngineRuntimeRevisionServiceClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ReasoningEngineRuntimeRevisionServiceClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + assert client.transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + ], +) +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() + + +def test_transport_kind_grpc(): + transport = ReasoningEngineRuntimeRevisionServiceClient.get_transport_class("grpc")( + credentials=ga_credentials.AnonymousCredentials() + ) + assert transport.kind == "grpc" + + +def test_initialize_client_w_grpc(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_reasoning_engine_runtime_revision_empty_call_grpc(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + client.get_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_reasoning_engine_runtime_revisions_empty_call_grpc(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + call.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + client.list_reasoning_engine_runtime_revisions(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_reasoning_engine_runtime_revision_empty_call_grpc(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.delete_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +def test_transport_kind_grpc_asyncio(): + transport = ReasoningEngineRuntimeRevisionServiceAsyncClient.get_transport_class( + "grpc_asyncio" + )(credentials=async_anonymous_credentials()) + assert transport.kind == "grpc_asyncio" + + +def test_initialize_client_w_grpc_asyncio(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="grpc_asyncio" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_empty_call_grpc_asyncio(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision( + name="name_value", + state=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE, + ) + ) + await client.get_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_empty_call_grpc_asyncio(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + next_page_token="next_page_token_value", + ) + ) + await client.list_reasoning_engine_runtime_revisions(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_empty_call_grpc_asyncio(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + await client.delete_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +def test_transport_kind_rest(): + transport = ReasoningEngineRuntimeRevisionServiceClient.get_transport_class("rest")( + credentials=ga_credentials.AnonymousCredentials() + ) + assert transport.kind == "rest" + + +def test_get_reasoning_engine_runtime_revision_rest_bad_request( + request_type=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_reasoning_engine_runtime_revision(request) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +def test_get_reasoning_engine_runtime_revision_rest_call_success(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision( + name="name_value", + state=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE, + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_reasoning_engine_runtime_revision(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + assert response.name == "name_value" + assert ( + response.state + == reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_reasoning_engine_runtime_revision_rest_interceptors(null_interceptor): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=( + None + if null_interceptor + else transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_get_reasoning_engine_runtime_revision", + ) as post, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_get_reasoning_engine_runtime_revision_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_get_reasoning_engine_runtime_revision", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest.pb( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.to_json( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + ) + req.return_value.content = return_value + + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + post_with_metadata.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + metadata, + ) + + client.get_reasoning_engine_runtime_revision( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +def test_list_reasoning_engine_runtime_revisions_rest_bad_request( + request_type=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + # send a request that will satisfy transcoding + request_init = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_reasoning_engine_runtime_revisions(request) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + dict, + ], +) +def test_list_reasoning_engine_runtime_revisions_rest_call_success(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReasoningEngineRuntimeRevisionsPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_reasoning_engine_runtime_revisions_rest_interceptors(null_interceptor): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=( + None + if null_interceptor + else transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_list_reasoning_engine_runtime_revisions", + ) as post, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_list_reasoning_engine_runtime_revisions_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_list_reasoning_engine_runtime_revisions", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest.pb( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.to_json( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + req.return_value.content = return_value + + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse(), + metadata, + ) + + client.list_reasoning_engine_runtime_revisions( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +def test_delete_reasoning_engine_runtime_revision_rest_bad_request( + request_type=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.delete_reasoning_engine_runtime_revision(request) + + +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +def test_delete_reasoning_engine_runtime_revision_rest_call_success(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the response is the type that we expect. + json_return_value = json_format.MessageToJson(return_value) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_reasoning_engine_runtime_revision_rest_interceptors(null_interceptor): + transport = transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=( + None + if null_interceptor + else transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_delete_reasoning_engine_runtime_revision", + ) as post, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_delete_reasoning_engine_runtime_revision_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_delete_reasoning_engine_runtime_revision", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest.pb( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = json_format.MessageToJson(operations_pb2.Operation()) + req.return_value.content = return_value + + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + post_with_metadata.return_value = operations_pb2.Operation(), metadata + + client.delete_reasoning_engine_runtime_revision( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationRequest): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_location(request) + + +@pytest.mark.parametrize( + "request_type", + [ + locations_pb2.GetLocationRequest, + dict, + ], +) +def test_get_location_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = locations_pb2.Location() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.get_location(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) + + +def test_list_locations_rest_bad_request( + request_type=locations_pb2.ListLocationsRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict({"name": "projects/sample1"}, request) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_locations(request) + + +@pytest.mark.parametrize( + "request_type", + [ + locations_pb2.ListLocationsRequest, + dict, + ], +) +def test_list_locations_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = locations_pb2.ListLocationsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.list_locations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) + + +def test_get_iam_policy_rest_bad_request( + request_type=iam_policy_pb2.GetIamPolicyRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_iam_policy(request) + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) +def test_get_iam_policy_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = policy_pb2.Policy() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.get_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + +def test_set_iam_policy_rest_bad_request( + request_type=iam_policy_pb2.SetIamPolicyRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_iam_policy(request) + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) +def test_set_iam_policy_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = policy_pb2.Policy() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + +def test_test_iam_permissions_rest_bad_request( + request_type=iam_policy_pb2.TestIamPermissionsRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.test_iam_permissions(request) + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], +) +def test_test_iam_permissions_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = iam_policy_pb2.TestIamPermissionsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.test_iam_permissions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + + +def test_cancel_operation_rest_bad_request( + request_type=operations_pb2.CancelOperationRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.cancel_operation(request) + + +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.CancelOperationRequest, + dict, + ], +) +def test_cancel_operation_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = "{}" + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.cancel_operation(request) + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_operation_rest_bad_request( + request_type=operations_pb2.DeleteOperationRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.delete_operation(request) + + +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.DeleteOperationRequest, + dict, + ], +) +def test_delete_operation_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = "{}" + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.delete_operation(request) + + # Establish that the response is the type that we expect. + assert response is None + + +def test_get_operation_rest_bad_request( + request_type=operations_pb2.GetOperationRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_operation(request) + + +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.GetOperationRequest, + dict, + ], +) +def test_get_operation_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.get_operation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + + +def test_list_operations_rest_bad_request( + request_type=operations_pb2.ListOperationsRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_operations(request) + + +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.ListOperationsRequest, + dict, + ], +) +def test_list_operations_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.ListOperationsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.list_operations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + + +def test_wait_operation_rest_bad_request( + request_type=operations_pb2.WaitOperationRequest, +): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + json_return_value = "" + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.wait_operation(request) + + +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.WaitOperationRequest, + dict, + ], +) +def test_wait_operation_rest(request_type): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode("UTF-8") + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.wait_operation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + + +def test_initialize_client_w_rest(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_reasoning_engine_runtime_revision_empty_call_rest(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + client.get_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_reasoning_engine_runtime_revisions_empty_call_rest(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + client.list_reasoning_engine_runtime_revisions(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_reasoning_engine_runtime_revision_empty_call_rest(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + client.delete_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +def test_reasoning_engine_runtime_revision_service_rest_lro_client(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have an api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_transport_kind_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = ReasoningEngineRuntimeRevisionServiceAsyncClient.get_transport_class( + "rest_asyncio" + )(credentials=async_anonymous_credentials()) + assert transport.kind == "rest_asyncio" + + +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_rest_asyncio_bad_request( + request_type=reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.get_reasoning_engine_runtime_revision(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +async def test_get_reasoning_engine_runtime_revision_rest_asyncio_call_success( + request_type, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision( + name="name_value", + state=reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE, + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = await client.get_reasoning_engine_runtime_revision(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision + ) + assert response.name == "name_value" + assert ( + response.state + == reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.State.ACTIVE + ) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("null_interceptor", [True, False]) +async def test_get_reasoning_engine_runtime_revision_rest_asyncio_interceptors( + null_interceptor, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = transports.AsyncReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=async_anonymous_credentials(), + interceptor=( + None + if null_interceptor + else transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_get_reasoning_engine_runtime_revision", + ) as post, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_get_reasoning_engine_runtime_revision_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_get_reasoning_engine_runtime_revision", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest.pb( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision.to_json( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + ) + req.return_value.read = mock.AsyncMock(return_value=return_value) + + request = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision() + ) + post_with_metadata.return_value = ( + reasoning_engine_runtime_revision.ReasoningEngineRuntimeRevision(), + metadata, + ) + + await client.get_reasoning_engine_runtime_revision( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_rest_asyncio_bad_request( + request_type=reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + # send a request that will satisfy transcoding + request_init = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.list_reasoning_engine_runtime_revisions(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest, + dict, + ], +) +async def test_list_reasoning_engine_runtime_revisions_rest_asyncio_call_success( + request_type, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + + # send a request that will satisfy transcoding + request_init = { + "parent": "projects/sample1/locations/sample2/reasoningEngines/sample3" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = await client.list_reasoning_engine_runtime_revisions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReasoningEngineRuntimeRevisionsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("null_interceptor", [True, False]) +async def test_list_reasoning_engine_runtime_revisions_rest_asyncio_interceptors( + null_interceptor, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = transports.AsyncReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=async_anonymous_credentials(), + interceptor=( + None + if null_interceptor + else transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_list_reasoning_engine_runtime_revisions", + ) as post, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_list_reasoning_engine_runtime_revisions_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_list_reasoning_engine_runtime_revisions", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest.pb( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse.to_json( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + req.return_value.read = mock.AsyncMock(return_value=return_value) + + request = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse() + ) + post_with_metadata.return_value = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsResponse(), + metadata, + ) + + await client.list_reasoning_engine_runtime_revisions( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_rest_asyncio_bad_request( + request_type=reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.delete_reasoning_engine_runtime_revision(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest, + dict, + ], +) +async def test_delete_reasoning_engine_runtime_revision_rest_asyncio_call_success( + request_type, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "projects/sample1/locations/sample2/reasoningEngines/sample3/runtimeRevisions/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = await client.delete_reasoning_engine_runtime_revision(request) + + # Establish that the response is the type that we expect. + json_return_value = json_format.MessageToJson(return_value) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("null_interceptor", [True, False]) +async def test_delete_reasoning_engine_runtime_revision_rest_asyncio_interceptors( + null_interceptor, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + transport = transports.AsyncReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=async_anonymous_credentials(), + interceptor=( + None + if null_interceptor + else transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor() + ), + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient(transport=transport) + + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_delete_reasoning_engine_runtime_revision", + ) as post, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "post_delete_reasoning_engine_runtime_revision_with_metadata", + ) as post_with_metadata, mock.patch.object( + transports.AsyncReasoningEngineRuntimeRevisionServiceRestInterceptor, + "pre_delete_reasoning_engine_runtime_revision", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + post_with_metadata.assert_not_called() + pb_message = reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest.pb( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = json_format.MessageToJson(operations_pb2.Operation()) + req.return_value.read = mock.AsyncMock(return_value=return_value) + + request = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + post_with_metadata.return_value = operations_pb2.Operation(), metadata + + await client.delete_reasoning_engine_runtime_revision( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + post_with_metadata.assert_called_once() + + +@pytest.mark.asyncio +async def test_get_location_rest_asyncio_bad_request( + request_type=locations_pb2.GetLocationRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.get_location(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + locations_pb2.GetLocationRequest, + dict, + ], +) +async def test_get_location_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = locations_pb2.Location() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.get_location(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) + + +@pytest.mark.asyncio +async def test_list_locations_rest_asyncio_bad_request( + request_type=locations_pb2.ListLocationsRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict({"name": "projects/sample1"}, request) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.list_locations(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + locations_pb2.ListLocationsRequest, + dict, + ], +) +async def test_list_locations_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = locations_pb2.ListLocationsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.list_locations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) + + +@pytest.mark.asyncio +async def test_get_iam_policy_rest_asyncio_bad_request( + request_type=iam_policy_pb2.GetIamPolicyRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.get_iam_policy(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) +async def test_get_iam_policy_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = policy_pb2.Policy() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.get_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + +@pytest.mark.asyncio +async def test_set_iam_policy_rest_asyncio_bad_request( + request_type=iam_policy_pb2.SetIamPolicyRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.set_iam_policy(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) +async def test_set_iam_policy_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = policy_pb2.Policy() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.set_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + +@pytest.mark.asyncio +async def test_test_iam_permissions_rest_asyncio_bad_request( + request_type=iam_policy_pb2.TestIamPermissionsRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"resource": "projects/sample1/locations/sample2/featurestores/sample3"}, + request, + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.test_iam_permissions(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], +) +async def test_test_iam_permissions_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = { + "resource": "projects/sample1/locations/sample2/featurestores/sample3" + } + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = iam_policy_pb2.TestIamPermissionsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.test_iam_permissions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + + +@pytest.mark.asyncio +async def test_cancel_operation_rest_asyncio_bad_request( + request_type=operations_pb2.CancelOperationRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.cancel_operation(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.CancelOperationRequest, + dict, + ], +) +async def test_cancel_operation_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = "{}" + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.cancel_operation(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_operation_rest_asyncio_bad_request( + request_type=operations_pb2.DeleteOperationRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.delete_operation(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.DeleteOperationRequest, + dict, + ], +) +async def test_delete_operation_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = "{}" + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.delete_operation(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_get_operation_rest_asyncio_bad_request( + request_type=operations_pb2.GetOperationRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.get_operation(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.GetOperationRequest, + dict, + ], +) +async def test_get_operation_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.get_operation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + + +@pytest.mark.asyncio +async def test_list_operations_rest_asyncio_bad_request( + request_type=operations_pb2.ListOperationsRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.list_operations(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.ListOperationsRequest, + dict, + ], +) +async def test_list_operations_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.ListOperationsResponse() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.list_operations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + + +@pytest.mark.asyncio +async def test_wait_operation_rest_asyncio_bad_request( + request_type=operations_pb2.WaitOperationRequest, +): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + request = request_type() + request = json_format.ParseDict( + {"name": "projects/sample1/locations/sample2/operations/sample3"}, request + ) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(AsyncAuthorizedSession, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.read = mock.AsyncMock(return_value=b"{}") + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + await client.wait_operation(request) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + operations_pb2.WaitOperationRequest, + dict, + ], +) +async def test_wait_operation_rest_asyncio(request_type): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(AsyncAuthorizedSession, "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation() + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + response_value.read = mock.AsyncMock( + return_value=json_return_value.encode("UTF-8") + ) + + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = await client.wait_operation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + + +def test_initialize_client_w_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_reasoning_engine_runtime_revision_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_reasoning_engine_runtime_revision), "__call__" + ) as call: + await client.get_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.GetReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_reasoning_engine_runtime_revisions_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_reasoning_engine_runtime_revisions), "__call__" + ) as call: + await client.list_reasoning_engine_runtime_revisions(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.ListReasoningEngineRuntimeRevisionsRequest() + ) + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_reasoning_engine_runtime_revision_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_reasoning_engine_runtime_revision), "__call__" + ) as call: + await client.delete_reasoning_engine_runtime_revision(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = ( + reasoning_engine_runtime_revision_service.DeleteReasoningEngineRuntimeRevisionRequest() + ) + + assert args[0] == request_msg + + +def test_reasoning_engine_runtime_revision_service_rest_asyncio_lro_client(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + transport = client.transport + + # Ensure that we have an api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AsyncOperationsRestClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_unsupported_parameter_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + options = client_options.ClientOptions(quota_project_id="octopus") + with pytest.raises(core_exceptions.AsyncRestUnsupportedParameterError, match="google.api_core.client_options.ClientOptions.quota_project_id") as exc: # type: ignore + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + client_options=options, + ) + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + ) + + +def test_reasoning_engine_runtime_revision_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.ReasoningEngineRuntimeRevisionServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_reasoning_engine_runtime_revision_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.transports.ReasoningEngineRuntimeRevisionServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.ReasoningEngineRuntimeRevisionServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "get_reasoning_engine_runtime_revision", + "list_reasoning_engine_runtime_revisions", + "delete_reasoning_engine_runtime_revision", + "set_iam_policy", + "get_iam_policy", + "test_iam_permissions", + "get_location", + "list_locations", + "get_operation", + "wait_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_reasoning_engine_runtime_revision_service_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.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.transports.ReasoningEngineRuntimeRevisionServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ReasoningEngineRuntimeRevisionServiceTransport( + 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_reasoning_engine_runtime_revision_service_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.aiplatform_v1beta1.services.reasoning_engine_runtime_revision_service.transports.ReasoningEngineRuntimeRevisionServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ReasoningEngineRuntimeRevisionServiceTransport() + adc.assert_called_once() + + +def test_reasoning_engine_runtime_revision_service_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) + ReasoningEngineRuntimeRevisionServiceClient() + 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.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + ], +) +def test_reasoning_engine_runtime_revision_service_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.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + transports.ReasoningEngineRuntimeRevisionServiceRestTransport, + ], +) +def test_reasoning_engine_runtime_revision_service_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.ReasoningEngineRuntimeRevisionServiceGrpcTransport, grpc_helpers), + ( + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +def test_reasoning_engine_runtime_revision_service_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( + "aiplatform.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="aiplatform.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + ], +) +def test_reasoning_engine_runtime_revision_service_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 + ) + + +def test_reasoning_engine_runtime_revision_service_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.ReasoningEngineRuntimeRevisionServiceRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + "rest", + ], +) +def test_reasoning_engine_runtime_revision_service_host_no_port(transport_name): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="aiplatform.googleapis.com" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "aiplatform.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://aiplatform.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + "rest", + ], +) +def test_reasoning_engine_runtime_revision_service_host_with_port(transport_name): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="aiplatform.googleapis.com:8000" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "aiplatform.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://aiplatform.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_reasoning_engine_runtime_revision_service_client_transport_session_collision( + transport_name, +): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=creds1, + transport=transport_name, + ) + client2 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.get_reasoning_engine_runtime_revision._session + session2 = client2.transport.get_reasoning_engine_runtime_revision._session + assert session1 != session2 + session1 = client1.transport.list_reasoning_engine_runtime_revisions._session + session2 = client2.transport.list_reasoning_engine_runtime_revisions._session + assert session1 != session2 + session1 = client1.transport.delete_reasoning_engine_runtime_revision._session + session2 = client2.transport.delete_reasoning_engine_runtime_revision._session + assert session1 != session2 + + +def test_reasoning_engine_runtime_revision_service_grpc_transport_channel(): + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport( + 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_reasoning_engine_runtime_revision_service_grpc_asyncio_transport_channel(): + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport( + 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.filterwarnings("ignore::FutureWarning") +@pytest.mark.parametrize( + "transport_class", + [ + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + ], +) +def test_reasoning_engine_runtime_revision_service_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.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + ], +) +def test_reasoning_engine_runtime_revision_service_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_reasoning_engine_runtime_revision_service_grpc_lro_client(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_reasoning_engine_runtime_revision_service_grpc_lro_async_client(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + 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_git_repository_link_path(): + project = "squid" + location = "clam" + connection = "whelk" + git_repository_link = "octopus" + expected = "projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{git_repository_link}".format( + project=project, + location=location, + connection=connection, + git_repository_link=git_repository_link, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.git_repository_link_path( + project, location, connection, git_repository_link + ) + assert expected == actual + + +def test_parse_git_repository_link_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "connection": "cuttlefish", + "git_repository_link": "mussel", + } + path = ReasoningEngineRuntimeRevisionServiceClient.git_repository_link_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_git_repository_link_path( + path + ) + assert expected == actual + + +def test_network_attachment_path(): + project = "winkle" + region = "nautilus" + networkattachment = "scallop" + expected = "projects/{project}/regions/{region}/networkAttachments/{networkattachment}".format( + project=project, + region=region, + networkattachment=networkattachment, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.network_attachment_path( + project, region, networkattachment + ) + assert expected == actual + + +def test_parse_network_attachment_path(): + expected = { + "project": "abalone", + "region": "squid", + "networkattachment": "clam", + } + path = ReasoningEngineRuntimeRevisionServiceClient.network_attachment_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_network_attachment_path( + path + ) + assert expected == actual + + +def test_reasoning_engine_path(): + project = "whelk" + location = "octopus" + reasoning_engine = "oyster" + expected = "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_path( + project, location, reasoning_engine + ) + assert expected == actual + + +def test_parse_reasoning_engine_path(): + expected = { + "project": "nudibranch", + "location": "cuttlefish", + "reasoning_engine": "mussel", + } + path = ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_path(**expected) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_reasoning_engine_path( + path + ) + assert expected == actual + + +def test_reasoning_engine_runtime_revision_path(): + project = "winkle" + location = "nautilus" + reasoning_engine = "scallop" + runtime_revision = "abalone" + expected = "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + runtime_revision=runtime_revision, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_runtime_revision_path( + project, location, reasoning_engine, runtime_revision + ) + assert expected == actual + + +def test_parse_reasoning_engine_runtime_revision_path(): + expected = { + "project": "squid", + "location": "clam", + "reasoning_engine": "whelk", + "runtime_revision": "octopus", + } + path = ReasoningEngineRuntimeRevisionServiceClient.reasoning_engine_runtime_revision_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_reasoning_engine_runtime_revision_path( + path + ) + assert expected == actual + + +def test_common_billing_account_path(): + billing_account = "oyster" + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.common_billing_account_path( + billing_account + ) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "nudibranch", + } + path = ReasoningEngineRuntimeRevisionServiceClient.common_billing_account_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ( + ReasoningEngineRuntimeRevisionServiceClient.parse_common_billing_account_path( + path + ) + ) + assert expected == actual + + +def test_common_folder_path(): + folder = "cuttlefish" + expected = "folders/{folder}".format( + folder=folder, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "mussel", + } + path = ReasoningEngineRuntimeRevisionServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "winkle" + expected = "organizations/{organization}".format( + organization=organization, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.common_organization_path( + organization + ) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nautilus", + } + path = ReasoningEngineRuntimeRevisionServiceClient.common_organization_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_common_organization_path( + path + ) + assert expected == actual + + +def test_common_project_path(): + project = "scallop" + expected = "projects/{project}".format( + project=project, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "abalone", + } + path = ReasoningEngineRuntimeRevisionServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "squid" + location = "clam" + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + actual = ReasoningEngineRuntimeRevisionServiceClient.common_location_path( + project, location + ) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "whelk", + "location": "octopus", + } + path = ReasoningEngineRuntimeRevisionServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = ReasoningEngineRuntimeRevisionServiceClient.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.ReasoningEngineRuntimeRevisionServiceTransport, + "_prep_wrapped_messages", + ) as prep: + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.ReasoningEngineRuntimeRevisionServiceTransport, + "_prep_wrapped_messages", + ) as prep: + transport_class = ( + ReasoningEngineRuntimeRevisionServiceClient.get_transport_class() + ) + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_delete_operation(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_delete_operation_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +def test_cancel_operation(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_cancel_operation_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +def test_wait_operation(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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.WaitOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + response = client.wait_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_wait_operation(transport: str = "grpc_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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.WaitOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_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.wait_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_wait_operation_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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.WaitOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + call.return_value = operations_pb2.Operation() + + client.wait_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_wait_operation_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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.WaitOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_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_wait_operation_from_dict(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + response = client.wait_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +@pytest.mark.asyncio +async def test_wait_operation_from_dict_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_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.wait_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_wait_operation_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +def test_get_operation(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_get_operation_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +def test_list_operations(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_operations_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +def test_list_locations(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_list_locations_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +def test_get_location(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials() + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials() + ) + + # Any value 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 = ReasoningEngineRuntimeRevisionServiceClient( + 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 = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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_get_location_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +def test_set_iam_policy(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 = iam_policy_pb2.SetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + response = client.set_iam_policy(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, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +@pytest.mark.asyncio +async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = iam_policy_pb2.SetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + ) + response = await client.set_iam_policy(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, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +def test_set_iam_policy_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + + client.set_iam_policy(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", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_set_iam_policy_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy(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", + "resource=resource/value", + ) in kw["metadata"] + + +def test_set_iam_policy_from_dict(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + response = client.set_iam_policy( + request={ + "resource": "resource_value", + "policy": policy_pb2.Policy(version=774), + } + ) + call.assert_called() + + +@pytest.mark.asyncio +async def test_set_iam_policy_from_dict_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + response = await client.set_iam_policy( + request={ + "resource": "resource_value", + "policy": policy_pb2.Policy(version=774), + } + ) + call.assert_called() + + +def test_set_iam_policy_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +def test_get_iam_policy(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 = iam_policy_pb2.GetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + + response = client.get_iam_policy(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, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +@pytest.mark.asyncio +async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = iam_policy_pb2.GetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + ) + + response = await client.get_iam_policy(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 response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +def test_get_iam_policy_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + + client.get_iam_policy(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", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_iam_policy_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy(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", + "resource=resource/value", + ) in kw["metadata"] + + +def test_get_iam_policy_from_dict(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + response = client.get_iam_policy( + request={ + "resource": "resource_value", + "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), + } + ) + call.assert_called() + + +@pytest.mark.asyncio +async def test_get_iam_policy_from_dict_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + response = await client.get_iam_policy( + request={ + "resource": "resource_value", + "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), + } + ) + call.assert_called() + + +def test_get_iam_policy_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +def test_test_iam_permissions(transport: str = "grpc"): + client = ReasoningEngineRuntimeRevisionServiceClient( + 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 = iam_policy_pb2.TestIamPermissionsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse( + permissions=["permissions_value"], + ) + + response = client.test_iam_permissions(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, iam_policy_pb2.TestIamPermissionsResponse) + + assert response.permissions == ["permissions_value"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + 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 = iam_policy_pb2.TestIamPermissionsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse( + permissions=["permissions_value"], + ) + ) + + response = await client.test_iam_permissions(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 response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + + assert response.permissions == ["permissions_value"] + + +def test_test_iam_permissions_field_headers(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions(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", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_field_headers_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions(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", + "resource=resource/value", + ) in kw["metadata"] + + +def test_test_iam_permissions_from_dict(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + response = client.test_iam_permissions( + request={ + "resource": "resource_value", + "permissions": ["permissions_value"], + } + ) + call.assert_called() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_from_dict_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + response = await client.test_iam_permissions( + request={ + "resource": "resource_value", + "permissions": ["permissions_value"], + } + ) + call.assert_called() + + +def test_test_iam_permissions_flattened(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +def test_transport_close_grpc(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc" + ) + with mock.patch.object( + type(getattr(client.transport, "_grpc_channel")), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +@pytest.mark.asyncio +async def test_transport_close_grpc_asyncio(): + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), 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_rest(): + client = ReasoningEngineRuntimeRevisionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + with mock.patch.object( + type(getattr(client.transport, "_session")), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +@pytest.mark.asyncio +async def test_transport_close_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip( + "the library must be installed with the `async_rest` extra to test this feature." + ) + client = ReasoningEngineRuntimeRevisionServiceAsyncClient( + credentials=async_anonymous_credentials(), transport="rest_asyncio" + ) + with mock.patch.object( + type(getattr(client.transport, "_session")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "rest", + "grpc", + ] + for transport in transports: + client = ReasoningEngineRuntimeRevisionServiceClient( + 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", + [ + ( + ReasoningEngineRuntimeRevisionServiceClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcTransport, + ), + ( + ReasoningEngineRuntimeRevisionServiceAsyncClient, + transports.ReasoningEngineRuntimeRevisionServiceGrpcAsyncIOTransport, + ), + ], +) +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_TEMPLATE.format( + UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE + ), + 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/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py index 1c866fde76..578c50cada 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -152,6 +147,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ReasoningEngineServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -174,6 +170,10 @@ def test__get_default_mtls_endpoint(): ReasoningEngineServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ReasoningEngineServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2657,11 +2657,7 @@ async def test_list_reasoning_engines_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_reasoning_engines(request={}) - ).pages: + async for page_ in (await client.list_reasoning_engines(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3482,7 +3478,7 @@ def test_create_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_reasoning_engine_rest_unset_required_fields(): @@ -3672,7 +3668,7 @@ def test_get_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_reasoning_engine_rest_unset_required_fields(): @@ -3867,7 +3863,7 @@ def test_list_reasoning_engines_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_reasoning_engines_rest_unset_required_fields(): @@ -4124,7 +4120,7 @@ def test_update_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_reasoning_engine_rest_unset_required_fields(): @@ -4314,7 +4310,7 @@ def test_delete_reasoning_engine_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_reasoning_engine_rest_unset_required_fields(): @@ -4887,6 +4883,17 @@ def test_create_reasoning_engine_rest_call_success(request_type): }, "encryption_spec": {"kms_key_name": "kms_key_name_value"}, "labels": {}, + "traffic_config": { + "traffic_split_manual": { + "targets": [ + { + "runtime_revision_name": "runtime_revision_name_value", + "percent": 753, + } + ] + }, + "traffic_split_always_latest": {}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -5450,6 +5457,17 @@ def test_update_reasoning_engine_rest_call_success(request_type): }, "encryption_spec": {"kms_key_name": "kms_key_name_value"}, "labels": {}, + "traffic_config": { + "traffic_split_manual": { + "targets": [ + { + "runtime_revision_name": "runtime_revision_name_value", + "percent": 753, + } + ] + }, + "traffic_split_always_latest": {}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -6635,6 +6653,17 @@ async def test_create_reasoning_engine_rest_asyncio_call_success(request_type): }, "encryption_spec": {"kms_key_name": "kms_key_name_value"}, "labels": {}, + "traffic_config": { + "traffic_split_manual": { + "targets": [ + { + "runtime_revision_name": "runtime_revision_name_value", + "percent": 753, + } + ] + }, + "traffic_split_always_latest": {}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -7252,6 +7281,17 @@ async def test_update_reasoning_engine_rest_asyncio_call_success(request_type): }, "encryption_spec": {"kms_key_name": "kms_key_name_value"}, "labels": {}, + "traffic_config": { + "traffic_split_manual": { + "targets": [ + { + "runtime_revision_name": "runtime_revision_name_value", + "percent": 753, + } + ] + }, + "traffic_split_always_latest": {}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -9090,8 +9130,43 @@ def test_parse_reasoning_engine_path(): assert expected == actual +def test_reasoning_engine_runtime_revision_path(): + project = "whelk" + location = "octopus" + reasoning_engine = "oyster" + runtime_revision = "nudibranch" + expected = "projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/runtimeRevisions/{runtime_revision}".format( + project=project, + location=location, + reasoning_engine=reasoning_engine, + runtime_revision=runtime_revision, + ) + actual = ReasoningEngineServiceClient.reasoning_engine_runtime_revision_path( + project, location, reasoning_engine, runtime_revision + ) + assert expected == actual + + +def test_parse_reasoning_engine_runtime_revision_path(): + expected = { + "project": "cuttlefish", + "location": "mussel", + "reasoning_engine": "winkle", + "runtime_revision": "nautilus", + } + path = ReasoningEngineServiceClient.reasoning_engine_runtime_revision_path( + **expected + ) + + # Check that the path construction is reversible. + actual = ReasoningEngineServiceClient.parse_reasoning_engine_runtime_revision_path( + path + ) + assert expected == actual + + def test_common_billing_account_path(): - billing_account = "whelk" + billing_account = "scallop" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -9101,7 +9176,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "octopus", + "billing_account": "abalone", } path = ReasoningEngineServiceClient.common_billing_account_path(**expected) @@ -9111,7 +9186,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "oyster" + folder = "squid" expected = "folders/{folder}".format( folder=folder, ) @@ -9121,7 +9196,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "nudibranch", + "folder": "clam", } path = ReasoningEngineServiceClient.common_folder_path(**expected) @@ -9131,7 +9206,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "cuttlefish" + organization = "whelk" expected = "organizations/{organization}".format( organization=organization, ) @@ -9141,7 +9216,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "mussel", + "organization": "octopus", } path = ReasoningEngineServiceClient.common_organization_path(**expected) @@ -9151,7 +9226,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "winkle" + project = "oyster" expected = "projects/{project}".format( project=project, ) @@ -9161,7 +9236,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "nautilus", + "project": "nudibranch", } path = ReasoningEngineServiceClient.common_project_path(**expected) @@ -9171,8 +9246,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "scallop" - location = "abalone" + project = "cuttlefish" + location = "mussel" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -9183,8 +9258,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "squid", - "location": "clam", + "project": "winkle", + "location": "nautilus", } path = ReasoningEngineServiceClient.common_location_path(**expected) @@ -9355,6 +9430,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ReasoningEngineServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9494,6 +9601,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ReasoningEngineServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9639,6 +9778,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9784,6 +9957,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9929,6 +10136,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10074,6 +10315,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ReasoningEngineServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10219,6 +10494,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10383,6 +10692,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10550,6 +10894,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10727,6 +11106,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ReasoningEngineServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ReasoningEngineServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ReasoningEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py index dad2eb2a87..30ceb1b9e9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -175,6 +170,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert ScheduleServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -196,6 +192,10 @@ def test__get_default_mtls_endpoint(): assert ( ScheduleServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + ScheduleServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2946,11 +2946,7 @@ async def test_list_schedules_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_schedules(request={}) - ).pages: + async for page_ in (await client.list_schedules(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4059,7 +4055,7 @@ def test_create_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_schedule_rest_unset_required_fields(): @@ -4248,7 +4244,7 @@ def test_delete_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_schedule_rest_unset_required_fields(): @@ -4426,7 +4422,7 @@ def test_get_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_schedule_rest_unset_required_fields(): @@ -4615,7 +4611,7 @@ def test_list_schedules_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_schedules_rest_unset_required_fields(): @@ -4864,7 +4860,7 @@ def test_pause_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_pause_schedule_rest_unset_required_fields(): @@ -5040,7 +5036,7 @@ def test_resume_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_resume_schedule_rest_unset_required_fields(): @@ -5218,7 +5214,7 @@ def test_update_schedule_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_schedule_rest_unset_required_fields(): @@ -12467,6 +12463,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = ScheduleServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12606,6 +12634,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = ScheduleServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12751,6 +12811,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12896,6 +12990,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = ScheduleServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13041,6 +13169,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = ScheduleServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13186,6 +13348,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = ScheduleServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13327,6 +13523,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13491,6 +13721,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13658,6 +13923,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13835,6 +14135,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = ScheduleServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = ScheduleServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = ScheduleServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_session_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_session_service.py index f79854f8c8..44d0d8eaf7 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_session_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_session_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -150,6 +145,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert SessionServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -171,6 +167,10 @@ def test__get_default_mtls_endpoint(): assert ( SessionServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + SessionServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2536,11 +2536,7 @@ async def test_list_sessions_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_sessions(request={}) - ).pages: + async for page_ in (await client.list_sessions(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3727,11 +3723,7 @@ async def test_list_events_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_events(request={}) - ).pages: + async for page_ in (await client.list_events(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4176,7 +4168,7 @@ def test_create_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_session_rest_unset_required_fields(): @@ -4370,7 +4362,7 @@ def test_get_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_session_rest_unset_required_fields(): @@ -4559,7 +4551,7 @@ def test_list_sessions_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_sessions_rest_unset_required_fields(): @@ -4812,7 +4804,7 @@ def test_update_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_session_rest_unset_required_fields(): @@ -5001,7 +4993,7 @@ def test_delete_session_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_session_rest_unset_required_fields(): @@ -5188,7 +5180,7 @@ def test_list_events_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_events_rest_unset_required_fields(): @@ -5444,7 +5436,7 @@ def test_append_event_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_append_event_rest_unset_required_fields(): @@ -11340,6 +11332,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = SessionServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11479,6 +11503,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = SessionServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11624,6 +11680,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11769,6 +11859,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = SessionServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11914,6 +12038,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = SessionServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12059,6 +12217,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = SessionServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12200,6 +12392,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12364,6 +12590,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12531,6 +12792,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12708,6 +13004,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = SessionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = SessionServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py index ffed9cc7e5..300b1990e9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -144,6 +139,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert SpecialistPoolServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -166,6 +162,10 @@ def test__get_default_mtls_endpoint(): SpecialistPoolServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + SpecialistPoolServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2651,11 +2651,7 @@ async def test_list_specialist_pools_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_specialist_pools(request={}) - ).pages: + async for page_ in (await client.list_specialist_pools(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3476,7 +3472,7 @@ def test_create_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_specialist_pool_rest_unset_required_fields(): @@ -3666,7 +3662,7 @@ def test_get_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_specialist_pool_rest_unset_required_fields(): @@ -3861,7 +3857,7 @@ def test_list_specialist_pools_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_specialist_pools_rest_unset_required_fields(): @@ -4122,7 +4118,7 @@ def test_delete_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_specialist_pool_rest_unset_required_fields(): @@ -4304,7 +4300,7 @@ def test_update_specialist_pool_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_specialist_pool_rest_unset_required_fields(): @@ -9024,6 +9020,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = SpecialistPoolServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9163,6 +9191,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = SpecialistPoolServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9308,6 +9368,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9453,6 +9547,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9598,6 +9726,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9743,6 +9905,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = SpecialistPoolServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9886,6 +10082,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10050,6 +10280,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10217,6 +10482,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10394,6 +10694,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = SpecialistPoolServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = SpecialistPoolServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = SpecialistPoolServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py index c4d833c674..f31b47b0ae 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -157,6 +152,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert TensorboardServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -179,6 +175,10 @@ def test__get_default_mtls_endpoint(): TensorboardServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + TensorboardServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2990,11 +2990,7 @@ async def test_list_tensorboards_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tensorboards(request={}) - ).pages: + async for page_ in (await client.list_tensorboards(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5695,9 +5691,7 @@ async def test_list_tensorboard_experiments_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_tensorboard_experiments(request={}) ).pages: pages.append(page_) @@ -8044,11 +8038,7 @@ async def test_list_tensorboard_runs_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_tensorboard_runs(request={}) - ).pages: + async for page_ in (await client.list_tensorboard_runs(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -10486,9 +10476,7 @@ async def test_list_tensorboard_time_series_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.list_tensorboard_time_series(request={}) ).pages: pages.append(page_) @@ -13181,9 +13169,7 @@ async def test_export_tensorboard_time_series_data_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch + async for page_ in ( await client.export_tensorboard_time_series_data(request={}) ).pages: pages.append(page_) @@ -13305,7 +13291,7 @@ def test_create_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_rest_unset_required_fields(): @@ -13491,7 +13477,7 @@ def test_get_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_rest_unset_required_fields(): @@ -13674,7 +13660,7 @@ def test_update_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_rest_unset_required_fields(): @@ -13876,7 +13862,7 @@ def test_list_tensorboards_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboards_rest_unset_required_fields(): @@ -14133,7 +14119,7 @@ def test_delete_tensorboard_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_rest_unset_required_fields(): @@ -14318,7 +14304,7 @@ def test_read_tensorboard_usage_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_usage_rest_unset_required_fields(): @@ -14505,7 +14491,7 @@ def test_read_tensorboard_size_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_size_rest_unset_required_fields(): @@ -14714,7 +14700,7 @@ def test_create_tensorboard_experiment_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_experiment_rest_unset_required_fields(): @@ -14917,7 +14903,7 @@ def test_get_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_experiment_rest_unset_required_fields(): @@ -15102,7 +15088,7 @@ def test_update_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_experiment_rest_unset_required_fields(): @@ -15317,7 +15303,7 @@ def test_list_tensorboard_experiments_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_experiments_rest_unset_required_fields(): @@ -15584,7 +15570,7 @@ def test_delete_tensorboard_experiment_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_experiment_rest_unset_required_fields(): @@ -15785,7 +15771,7 @@ def test_create_tensorboard_run_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_run_rest_unset_required_fields(): @@ -15986,7 +15972,7 @@ def test_batch_create_tensorboard_runs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_tensorboard_runs_rest_unset_required_fields(): @@ -16188,7 +16174,7 @@ def test_get_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_run_rest_unset_required_fields(): @@ -16371,7 +16357,7 @@ def test_update_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_run_rest_unset_required_fields(): @@ -16580,7 +16566,7 @@ def test_list_tensorboard_runs_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_runs_rest_unset_required_fields(): @@ -16842,7 +16828,7 @@ def test_delete_tensorboard_run_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_run_rest_unset_required_fields(): @@ -17030,7 +17016,7 @@ def test_batch_create_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_tensorboard_time_series_rest_unset_required_fields(): @@ -17244,7 +17230,7 @@ def test_create_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_tensorboard_time_series_rest_unset_required_fields(): @@ -17449,7 +17435,7 @@ def test_get_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_tensorboard_time_series_rest_unset_required_fields(): @@ -17634,7 +17620,7 @@ def test_update_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_tensorboard_time_series_rest_unset_required_fields(): @@ -17851,7 +17837,7 @@ def test_list_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_tensorboard_time_series_rest_unset_required_fields(): @@ -18119,7 +18105,7 @@ def test_delete_tensorboard_time_series_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_tensorboard_time_series_rest_unset_required_fields(): @@ -18327,7 +18313,7 @@ def test_batch_read_tensorboard_time_series_data_rest_required_fields( ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_read_tensorboard_time_series_data_rest_unset_required_fields(): @@ -18537,7 +18523,7 @@ def test_read_tensorboard_time_series_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_time_series_data_rest_unset_required_fields(): @@ -18743,7 +18729,7 @@ def test_read_tensorboard_blob_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_read_tensorboard_blob_data_rest_unset_required_fields(): @@ -18938,7 +18924,7 @@ def test_write_tensorboard_experiment_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_tensorboard_experiment_data_rest_unset_required_fields(): @@ -19150,7 +19136,7 @@ def test_write_tensorboard_run_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_write_tensorboard_run_data_rest_unset_required_fields(): @@ -19360,7 +19346,7 @@ def test_export_tensorboard_time_series_data_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_export_tensorboard_time_series_data_rest_unset_required_fields(): @@ -35392,6 +35378,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = TensorboardServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35531,6 +35549,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = TensorboardServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35676,6 +35726,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35821,6 +35905,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = TensorboardServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35966,6 +36084,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = TensorboardServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36111,6 +36263,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = TensorboardServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36252,6 +36438,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36416,6 +36636,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36583,6 +36838,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36760,6 +37050,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = TensorboardServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = TensorboardServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = TensorboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py index 10fdaf52e3..e1769833be 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -147,6 +142,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VertexRagDataServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -169,6 +165,10 @@ def test__get_default_mtls_endpoint(): VertexRagDataServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VertexRagDataServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3010,11 +3010,7 @@ async def test_list_rag_corpora_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_corpora(request={}) - ).pages: + async for page_ in (await client.list_rag_corpora(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4956,11 +4952,7 @@ async def test_list_rag_files_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_files(request={}) - ).pages: + async for page_ in (await client.list_rag_files(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7493,11 +7485,7 @@ async def test_list_rag_data_schemas_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_data_schemas(request={}) - ).pages: + async for page_ in (await client.list_rag_data_schemas(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -9918,11 +9906,7 @@ async def test_list_rag_metadata_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_rag_metadata(request={}) - ).pages: + async for page_ in (await client.list_rag_metadata(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -10631,7 +10615,7 @@ def test_create_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_rag_corpus_rest_unset_required_fields(): @@ -10828,7 +10812,7 @@ def test_update_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_rag_corpus_rest_unset_required_fields(): @@ -11020,7 +11004,7 @@ def test_get_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_corpus_rest_unset_required_fields(): @@ -11211,7 +11195,7 @@ def test_list_rag_corpora_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_corpora_rest_unset_required_fields(): @@ -11470,7 +11454,7 @@ def test_delete_rag_corpus_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_corpus_rest_unset_required_fields(): @@ -11659,7 +11643,7 @@ def test_upload_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_upload_rag_file_rest_unset_required_fields(): @@ -11872,7 +11856,7 @@ def test_import_rag_files_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_import_rag_files_rest_unset_required_fields(): @@ -12064,7 +12048,7 @@ def test_get_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_file_rest_unset_required_fields(): @@ -12251,7 +12235,7 @@ def test_list_rag_files_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_files_rest_unset_required_fields(): @@ -12507,7 +12491,7 @@ def test_delete_rag_file_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_file_rest_unset_required_fields(): @@ -12687,7 +12671,7 @@ def test_update_rag_engine_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_rag_engine_config_rest_unset_required_fields(): @@ -12872,7 +12856,7 @@ def test_get_rag_engine_config_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_engine_config_rest_unset_required_fields(): @@ -13058,7 +13042,7 @@ def test_create_rag_data_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_rag_data_schema_rest_unset_required_fields(): @@ -13257,7 +13241,7 @@ def test_batch_create_rag_data_schemas_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_rag_data_schemas_rest_unset_required_fields(): @@ -13391,7 +13375,7 @@ def test_get_rag_data_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_data_schema_rest_unset_required_fields(): @@ -13585,7 +13569,7 @@ def test_list_rag_data_schemas_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_data_schemas_rest_unset_required_fields(): @@ -13843,7 +13827,7 @@ def test_delete_rag_data_schema_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_data_schema_rest_unset_required_fields(): @@ -14032,7 +14016,7 @@ def test_batch_delete_rag_data_schemas_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_delete_rag_data_schemas_rest_unset_required_fields(): @@ -14169,7 +14153,7 @@ def test_create_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_rag_metadata_rest_unset_required_fields(): @@ -14368,7 +14352,7 @@ def test_batch_create_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_create_rag_metadata_rest_unset_required_fields(): @@ -14496,7 +14480,7 @@ def test_update_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_update_rag_metadata_rest_unset_required_fields(): @@ -14680,7 +14664,7 @@ def test_get_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_rag_metadata_rest_unset_required_fields(): @@ -14871,7 +14855,7 @@ def test_list_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_rag_metadata_rest_unset_required_fields(): @@ -15125,7 +15109,7 @@ def test_delete_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_rag_metadata_rest_unset_required_fields(): @@ -15314,7 +15298,7 @@ def test_batch_delete_rag_metadata_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_batch_delete_rag_metadata_rest_unset_required_fields(): @@ -28607,6 +28591,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VertexRagDataServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28746,6 +28762,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VertexRagDataServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28891,6 +28939,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29036,6 +29118,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29181,6 +29297,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29326,6 +29476,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VertexRagDataServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29469,6 +29653,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29633,6 +29851,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29800,6 +30053,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29977,6 +30265,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VertexRagDataServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VertexRagDataServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VertexRagDataServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py index 5879c658b5..f2535452fc 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -145,6 +140,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VertexRagServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -167,6 +163,10 @@ def test__get_default_mtls_endpoint(): VertexRagServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VertexRagServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -3209,7 +3209,7 @@ def test_retrieve_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_retrieve_contexts_rest_unset_required_fields(): @@ -3398,7 +3398,7 @@ def test_augment_prompt_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_augment_prompt_rest_unset_required_fields(): @@ -3586,7 +3586,7 @@ def test_corroborate_content_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_corroborate_content_rest_unset_required_fields(): @@ -3769,7 +3769,7 @@ def test_ask_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_ask_contexts_rest_unset_required_fields(): @@ -3964,7 +3964,7 @@ def test_async_retrieve_contexts_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_async_retrieve_contexts_rest_unset_required_fields(): @@ -8263,6 +8263,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VertexRagServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8402,6 +8434,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VertexRagServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8547,6 +8611,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8692,6 +8790,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VertexRagServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8837,6 +8969,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VertexRagServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8982,6 +9148,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VertexRagServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9123,6 +9323,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9287,6 +9521,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9454,6 +9723,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9631,6 +9935,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VertexRagServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VertexRagServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VertexRagServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py index 8262a9d887..830d62945e 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,8 @@ # 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 +from unittest import mock +from unittest.mock import AsyncMock import grpc from grpc.experimental import aio @@ -143,6 +138,7 @@ def test__get_default_mtls_endpoint(): sandbox_endpoint = "example.sandbox.googleapis.com" sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" non_googleapi = "api.example.com" + custom_endpoint = ".custom" assert VizierServiceClient._get_default_mtls_endpoint(None) is None assert ( @@ -164,6 +160,10 @@ def test__get_default_mtls_endpoint(): assert ( VizierServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi ) + assert ( + VizierServiceClient._get_default_mtls_endpoint(custom_endpoint) + == custom_endpoint + ) def test__read_environment_variables(): @@ -2507,11 +2507,7 @@ async def test_list_studies_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_studies(request={}) - ).pages: + async for page_ in (await client.list_studies(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4603,11 +4599,7 @@ async def test_list_trials_async_pages(): RuntimeError, ) pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_trials(request={}) - ).pages: + async for page_ in (await client.list_trials(request={})).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6423,7 +6415,7 @@ def test_create_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_study_rest_unset_required_fields(): @@ -6609,7 +6601,7 @@ def test_get_study_rest_required_fields(request_type=vizier_service.GetStudyRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_study_rest_unset_required_fields(): @@ -6794,7 +6786,7 @@ def test_list_studies_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_studies_rest_unset_required_fields(): @@ -7040,7 +7032,7 @@ def test_delete_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_study_rest_unset_required_fields(): @@ -7221,7 +7213,7 @@ def test_lookup_study_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_lookup_study_rest_unset_required_fields(): @@ -7417,7 +7409,7 @@ def test_suggest_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_suggest_trials_rest_unset_required_fields(): @@ -7547,7 +7539,7 @@ def test_create_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_create_trial_rest_unset_required_fields(): @@ -7735,7 +7727,7 @@ def test_get_trial_rest_required_fields(request_type=vizier_service.GetTrialRequ expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_get_trial_rest_unset_required_fields(): @@ -7922,7 +7914,7 @@ def test_list_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_trials_rest_unset_required_fields(): @@ -8179,7 +8171,7 @@ def test_add_trial_measurement_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_add_trial_measurement_rest_unset_required_fields(): @@ -8308,7 +8300,7 @@ def test_complete_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_complete_trial_rest_unset_required_fields(): @@ -8425,7 +8417,7 @@ def test_delete_trial_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_delete_trial_rest_unset_required_fields(): @@ -8610,7 +8602,7 @@ def test_check_trial_early_stopping_state_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_check_trial_early_stopping_state_rest_unset_required_fields(): @@ -8731,7 +8723,7 @@ def test_stop_trial_rest_required_fields(request_type=vizier_service.StopTrialRe expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_stop_trial_rest_unset_required_fields(): @@ -8856,7 +8848,7 @@ def test_list_optimal_trials_rest_required_fields( expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + assert sorted(expected_params) == sorted(actual_params) def test_list_optimal_trials_rest_unset_required_fields(): @@ -17466,6 +17458,38 @@ async def test_delete_operation_from_dict_async(): call.assert_called() +def test_delete_operation_flattened(): + client = VizierServiceClient( + 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 + + client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + +@pytest.mark.asyncio +async def test_delete_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.delete_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.DeleteOperationRequest() + + def test_cancel_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17605,6 +17629,38 @@ async def test_cancel_operation_from_dict_async(): call.assert_called() +def test_cancel_operation_flattened(): + client = VizierServiceClient( + 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 + + client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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) + await client.cancel_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.CancelOperationRequest() + + def test_wait_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17750,6 +17806,40 @@ async def test_wait_operation_from_dict_async(): call.assert_called() +def test_wait_operation_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + +@pytest.mark.asyncio +async def test_wait_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.wait_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.WaitOperationRequest() + + def test_get_operation(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17895,6 +17985,40 @@ async def test_get_operation_from_dict_async(): call.assert_called() +def test_get_operation_flattened(): + client = VizierServiceClient( + 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() + + client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_operation() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.GetOperationRequest() + + def test_list_operations(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18040,6 +18164,40 @@ async def test_list_operations_from_dict_async(): call.assert_called() +def test_list_operations_flattened(): + client = VizierServiceClient( + 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() + + client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_operations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == operations_pb2.ListOperationsRequest() + + def test_list_locations(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18185,6 +18343,40 @@ async def test_list_locations_from_dict_async(): call.assert_called() +def test_list_locations_flattened(): + client = VizierServiceClient( + 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() + + client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.list_locations() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.ListLocationsRequest() + + def test_get_location(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18326,6 +18518,40 @@ async def test_get_location_from_dict_async(): call.assert_called() +def test_get_location_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # 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() + + client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + +@pytest.mark.asyncio +async def test_get_location_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # 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() + ) + await client.get_location() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == locations_pb2.GetLocationRequest() + + def test_set_iam_policy(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18490,6 +18716,41 @@ async def test_set_iam_policy_from_dict_async(): call.assert_called() +def test_set_iam_policy_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + def test_get_iam_policy(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18657,6 +18918,41 @@ async def test_get_iam_policy_from_dict_async(): call.assert_called() +def test_get_iam_policy_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + def test_test_iam_permissions(transport: str = "grpc"): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18834,6 +19130,47 @@ async def test_test_iam_permissions_from_dict_async(): call.assert_called() +def test_test_iam_permissions_flattened(): + client = VizierServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_flattened_async(): + client = VizierServiceAsyncClient( + credentials=async_anonymous_credentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions() + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + def test_transport_close_grpc(): client = VizierServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc" diff --git a/tests/unit/gapic/definition_v1/__init__.py b/tests/unit/gapic/definition_v1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/definition_v1/__init__.py +++ b/tests/unit/gapic/definition_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/definition_v1beta1/__init__.py b/tests/unit/gapic/definition_v1beta1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/definition_v1beta1/__init__.py +++ b/tests/unit/gapic/definition_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/instance_v1/__init__.py b/tests/unit/gapic/instance_v1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/instance_v1/__init__.py +++ b/tests/unit/gapic/instance_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/instance_v1beta1/__init__.py b/tests/unit/gapic/instance_v1beta1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/instance_v1beta1/__init__.py +++ b/tests/unit/gapic/instance_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/params_v1/__init__.py b/tests/unit/gapic/params_v1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/params_v1/__init__.py +++ b/tests/unit/gapic/params_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/params_v1beta1/__init__.py b/tests/unit/gapic/params_v1beta1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/params_v1beta1/__init__.py +++ b/tests/unit/gapic/params_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/prediction_v1/__init__.py b/tests/unit/gapic/prediction_v1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/prediction_v1/__init__.py +++ b/tests/unit/gapic/prediction_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/prediction_v1beta1/__init__.py b/tests/unit/gapic/prediction_v1beta1/__init__.py index cbf94b283c..32b36c5c4f 100644 --- a/tests/unit/gapic/prediction_v1beta1/__init__.py +++ b/tests/unit/gapic/prediction_v1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.