diff --git a/.librarian/state.yaml b/.librarian/state.yaml index 2b8a475a0a..54354c8994 100644 --- a/.librarian/state.yaml +++ b/.librarian/state.yaml @@ -1,4 +1,4 @@ -image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91 +image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:eec191fc4904c204cd717c79812cd66997b5559776483ee223f69c8f43e99224 libraries: - id: google-cloud-spanner version: 3.60.0 diff --git a/LICENSE b/LICENSE index d645695673..e147aea5d7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Apache License Version 2.0, January 2004 diff --git a/docs/_static/custom.css b/docs/_static/custom.css index b0a295464b..ce087d01fa 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + div#python2-eol { border-color: red; border-width: medium; diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 95e9c77fcf..b9fbe002fa 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + {% extends "!layout.html" %} {%- block content %} diff --git a/docs/conf.py b/docs/conf.py index 010a6b6cda..52be27aff0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,6 +25,10 @@ # All configuration values have a default; values that are commented out # serve to show the default. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + import sys import os import shlex diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst index 536d17b2ea..2b9ef48897 100644 --- a/docs/multiprocessing.rst +++ b/docs/multiprocessing.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + .. note:: Because this client uses :mod:`grpc` library, it is safe to diff --git a/docs/spanner_admin_database_v1/database_admin.rst b/docs/spanner_admin_database_v1/database_admin.rst index bd6aab00e4..5dd775ff37 100644 --- a/docs/spanner_admin_database_v1/database_admin.rst +++ b/docs/spanner_admin_database_v1/database_admin.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + DatabaseAdmin ------------------------------- diff --git a/docs/spanner_admin_database_v1/services_.rst b/docs/spanner_admin_database_v1/services_.rst index 55e57d8dc0..4aa5d9ddd7 100644 --- a/docs/spanner_admin_database_v1/services_.rst +++ b/docs/spanner_admin_database_v1/services_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Services for Google Cloud Spanner Admin Database v1 API ======================================================= .. toctree:: diff --git a/docs/spanner_admin_database_v1/types_.rst b/docs/spanner_admin_database_v1/types_.rst index fe6c27778b..2f08c1c29c 100644 --- a/docs/spanner_admin_database_v1/types_.rst +++ b/docs/spanner_admin_database_v1/types_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Types for Google Cloud Spanner Admin Database v1 API ==================================================== diff --git a/docs/spanner_admin_instance_v1/instance_admin.rst b/docs/spanner_admin_instance_v1/instance_admin.rst index fe820b3fad..317451a609 100644 --- a/docs/spanner_admin_instance_v1/instance_admin.rst +++ b/docs/spanner_admin_instance_v1/instance_admin.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + InstanceAdmin ------------------------------- diff --git a/docs/spanner_admin_instance_v1/services_.rst b/docs/spanner_admin_instance_v1/services_.rst index 407d44cc34..9276433f70 100644 --- a/docs/spanner_admin_instance_v1/services_.rst +++ b/docs/spanner_admin_instance_v1/services_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Services for Google Cloud Spanner Admin Instance v1 API ======================================================= .. toctree:: diff --git a/docs/spanner_admin_instance_v1/types_.rst b/docs/spanner_admin_instance_v1/types_.rst index 250cf6bf9b..f84a1b2806 100644 --- a/docs/spanner_admin_instance_v1/types_.rst +++ b/docs/spanner_admin_instance_v1/types_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Types for Google Cloud Spanner Admin Instance v1 API ==================================================== diff --git a/docs/spanner_v1/services_.rst b/docs/spanner_v1/services_.rst index 3bbbb55f79..d038f336a7 100644 --- a/docs/spanner_v1/services_.rst +++ b/docs/spanner_v1/services_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Services for Google Cloud Spanner v1 API ======================================== .. toctree:: diff --git a/docs/spanner_v1/spanner.rst b/docs/spanner_v1/spanner.rst index b51f4447e4..04b47763b0 100644 --- a/docs/spanner_v1/spanner.rst +++ b/docs/spanner_v1/spanner.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Spanner ------------------------- diff --git a/docs/spanner_v1/types_.rst b/docs/spanner_v1/types_.rst index c7ff7e6c71..6bd325e9f2 100644 --- a/docs/spanner_v1/types_.rst +++ b/docs/spanner_v1/types_.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + Types for Google Cloud Spanner v1 API ===================================== diff --git a/google/cloud/spanner_admin_database_v1/__init__.py b/google/cloud/spanner_admin_database_v1/__init__.py index d7fddf0236..02d29c08d0 100644 --- a/google/cloud/spanner_admin_database_v1/__init__.py +++ b/google/cloud/spanner_admin_database_v1/__init__.py @@ -13,10 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from google.cloud.spanner_admin_database_v1 import gapic_version as package_version +import google.api_core as api_core +import sys + __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 .services.database_admin import DatabaseAdminClient from .services.database_admin import DatabaseAdminAsyncClient @@ -83,6 +97,100 @@ from .types.spanner_database_admin import UpdateDatabaseRequest from .types.spanner_database_admin import RestoreSourceType +if hasattr(api_core, "check_python_version") and hasattr( + api_core, "check_dependency_versions" +): # pragma: NO COVER + api_core.check_python_version("google.cloud.spanner_admin_database_v1") # type: ignore + api_core.check_dependency_versions("google.cloud.spanner_admin_database_v1") # type: ignore +else: # pragma: NO COVER + # An older version of api_core is installed which does not define the + # functions above. We do equivalent checks manually. + try: + import warnings + import sys + + _py_version_str = sys.version.split()[0] + _package_label = "google.cloud.spanner_admin_database_v1" + if sys.version_info < (3, 9): + 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}.", + FutureWarning, + ) + + def parse_version_to_tuple(version_string: str): + """Safely converts a semantic version string to a comparable tuple of integers. + Example: "4.25.8" -> (4, 25, 8) + Ignores non-numeric parts and handles common version formats. + Args: + version_string: Version string in the format "x.y.z" or "x.y.z" + Returns: + Tuple of integers for the parsed version string. + """ + parts = [] + for part in version_string.split("."): + try: + parts.append(int(part)) + except ValueError: + # If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here. + # This is a simplification compared to 'packaging.parse_version', but sufficient + # for comparing strictly numeric semantic versions. + break + return tuple(parts) + + def _get_version(dependency_name): + try: + version_string: str = metadata.version(dependency_name) + parsed_version = parse_version_to_tuple(version_string) + return (parsed_version, version_string) + except Exception: + # Catch exceptions from metadata.version() (e.g., PackageNotFoundError) + # or errors during parse_version_to_tuple + return (None, "--") + + _dependency_package = "google.protobuf" + _next_supported_version = "4.25.8" + _next_supported_version_tuple = (4, 25, 8) + _recommendation = " (we recommend 6.x)" + (_version_used, _version_used_string) = _get_version(_dependency_package) + if _version_used and _version_used < _next_supported_version_tuple: + warnings.warn( + f"Package {_package_label} depends on " + + f"{_dependency_package}, currently installed at version " + + f"{_version_used_string}. Future updates to " + + f"{_package_label} will require {_dependency_package} at " + + f"version {_next_supported_version} or higher{_recommendation}." + + " Please ensure " + + "that either (a) your Python environment doesn't pin the " + + f"version of {_dependency_package}, so that updates to " + + f"{_package_label} can require the higher version, or " + + "(b) you manually update your Python environment to use at " + + f"least version {_next_supported_version} of " + + f"{_dependency_package}.", + FutureWarning, + ) + except Exception: + warnings.warn( + "Could not determine the version of Python " + + "currently being used. To continue receiving " + + "updates for {_package_label}, ensure you are " + + "using a supported version of Python; see " + + "https://devguide.python.org/versions/" + ) + __all__ = ( "DatabaseAdminAsyncClient", "AddSplitPointsRequest", diff --git a/google/cloud/spanner_admin_database_v1/gapic_version.py b/google/cloud/spanner_admin_database_v1/gapic_version.py index 992322a033..d231182458 100644 --- a/google/cloud/spanner_admin_database_v1/gapic_version.py +++ b/google/cloud/spanner_admin_database_v1/gapic_version.py @@ -13,4 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + __version__ = "3.60.0" # {x-release-please-version} diff --git a/google/cloud/spanner_admin_database_v1/py.typed b/google/cloud/spanner_admin_database_v1/py.typed index 29f334aad6..540babe714 100644 --- a/google/cloud/spanner_admin_database_v1/py.typed +++ b/google/cloud/spanner_admin_database_v1/py.typed @@ -1,2 +1,6 @@ # Marker file for PEP 561. # The google-cloud-spanner-admin-database package uses inline types. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + diff --git a/google/cloud/spanner_admin_database_v1/services/__init__.py b/google/cloud/spanner_admin_database_v1/services/__init__.py index cbf94b283c..830ba96006 100644 --- a/google/cloud/spanner_admin_database_v1/services/__init__.py +++ b/google/cloud/spanner_admin_database_v1/services/__init__.py @@ -13,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py b/google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py index 580a7ed2a2..61bb4234f0 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .client import DatabaseAdminClient from .async_client import DatabaseAdminAsyncClient diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py b/google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py index 0e08065a7d..f8b8037cee 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging as std_logging from collections import OrderedDict import re diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/client.py b/google/cloud/spanner_admin_database_v1/services/database_admin/client.py index 5f85aa39b1..67d57387d5 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/client.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from http import HTTPStatus import json @@ -172,6 +176,34 @@ def _get_default_mtls_endpoint(api_endpoint): _DEFAULT_ENDPOINT_TEMPLATE = "spanner.{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 @@ -518,12 +550,8 @@ def get_mtls_endpoint_and_cert_source( ) if client_options is None: client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_client_cert = DatabaseAdminClient._use_client_cert_effective() use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" @@ -531,7 +559,7 @@ def get_mtls_endpoint_and_cert_source( # Figure out the client cert source to use. client_cert_source = None - if use_client_cert == "true": + 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(): @@ -563,20 +591,14 @@ def _read_environment_variables(): google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT is not any of ["auto", "never", "always"]. """ - use_client_cert = os.getenv( - "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" - ).lower() + use_client_cert = DatabaseAdminClient._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_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + return use_client_cert, use_mtls_endpoint, universe_domain_env @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py b/google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py index c9e2e14d52..9990a7139b 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + 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 diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/README.rst b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/README.rst index f70c023a98..6af06dded8 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/README.rst +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/README.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + transport inheritance structure _______________________________ diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py index 23ba04ea21..8624c8c77e 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from typing import Dict, Type diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py index 16a075d983..2d9144ca48 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py index 0888d9af16..a47e027fdf 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json import logging as std_logging import pickle diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py index 145c6ebf03..009be98d08 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import inspect import json import pickle diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py index dfec442041..5497ac9976 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging import json # type: ignore diff --git a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py index d0ee0a2cbb..672ea6366b 100644 --- a/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py +++ b/google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json # type: ignore from google.api_core import path_template from google.api_core import gapic_v1 diff --git a/google/cloud/spanner_admin_database_v1/types/__init__.py b/google/cloud/spanner_admin_database_v1/types/__init__.py index ca79ddec90..b4245fb686 100644 --- a/google/cloud/spanner_admin_database_v1/types/__init__.py +++ b/google/cloud/spanner_admin_database_v1/types/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .backup import ( Backup, BackupInfo, diff --git a/google/cloud/spanner_admin_database_v1/types/backup.py b/google/cloud/spanner_admin_database_v1/types/backup.py index da236fb4ff..7f7a199f02 100644 --- a/google/cloud/spanner_admin_database_v1/types/backup.py +++ b/google/cloud/spanner_admin_database_v1/types/backup.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_admin_database_v1/types/backup_schedule.py b/google/cloud/spanner_admin_database_v1/types/backup_schedule.py index 2773c1ef63..3fb198feaa 100644 --- a/google/cloud/spanner_admin_database_v1/types/backup_schedule.py +++ b/google/cloud/spanner_admin_database_v1/types/backup_schedule.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_admin_database_v1/types/common.py b/google/cloud/spanner_admin_database_v1/types/common.py index fff1a8756c..3f69bbd86b 100644 --- a/google/cloud/spanner_admin_database_v1/types/common.py +++ b/google/cloud/spanner_admin_database_v1/types/common.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py b/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py index c82fdc87df..b8ab162122 100644 --- a/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py +++ b/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_admin_instance_v1/__init__.py b/google/cloud/spanner_admin_instance_v1/__init__.py index 5368b59895..ed4438259d 100644 --- a/google/cloud/spanner_admin_instance_v1/__init__.py +++ b/google/cloud/spanner_admin_instance_v1/__init__.py @@ -13,10 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from google.cloud.spanner_admin_instance_v1 import gapic_version as package_version +import google.api_core as api_core +import sys + __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 .services.instance_admin import InstanceAdminClient from .services.instance_admin import InstanceAdminAsyncClient @@ -63,6 +77,100 @@ from .types.spanner_instance_admin import UpdateInstancePartitionRequest from .types.spanner_instance_admin import UpdateInstanceRequest +if hasattr(api_core, "check_python_version") and hasattr( + api_core, "check_dependency_versions" +): # pragma: NO COVER + api_core.check_python_version("google.cloud.spanner_admin_instance_v1") # type: ignore + api_core.check_dependency_versions("google.cloud.spanner_admin_instance_v1") # type: ignore +else: # pragma: NO COVER + # An older version of api_core is installed which does not define the + # functions above. We do equivalent checks manually. + try: + import warnings + import sys + + _py_version_str = sys.version.split()[0] + _package_label = "google.cloud.spanner_admin_instance_v1" + if sys.version_info < (3, 9): + 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}.", + FutureWarning, + ) + + def parse_version_to_tuple(version_string: str): + """Safely converts a semantic version string to a comparable tuple of integers. + Example: "4.25.8" -> (4, 25, 8) + Ignores non-numeric parts and handles common version formats. + Args: + version_string: Version string in the format "x.y.z" or "x.y.z" + Returns: + Tuple of integers for the parsed version string. + """ + parts = [] + for part in version_string.split("."): + try: + parts.append(int(part)) + except ValueError: + # If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here. + # This is a simplification compared to 'packaging.parse_version', but sufficient + # for comparing strictly numeric semantic versions. + break + return tuple(parts) + + def _get_version(dependency_name): + try: + version_string: str = metadata.version(dependency_name) + parsed_version = parse_version_to_tuple(version_string) + return (parsed_version, version_string) + except Exception: + # Catch exceptions from metadata.version() (e.g., PackageNotFoundError) + # or errors during parse_version_to_tuple + return (None, "--") + + _dependency_package = "google.protobuf" + _next_supported_version = "4.25.8" + _next_supported_version_tuple = (4, 25, 8) + _recommendation = " (we recommend 6.x)" + (_version_used, _version_used_string) = _get_version(_dependency_package) + if _version_used and _version_used < _next_supported_version_tuple: + warnings.warn( + f"Package {_package_label} depends on " + + f"{_dependency_package}, currently installed at version " + + f"{_version_used_string}. Future updates to " + + f"{_package_label} will require {_dependency_package} at " + + f"version {_next_supported_version} or higher{_recommendation}." + + " Please ensure " + + "that either (a) your Python environment doesn't pin the " + + f"version of {_dependency_package}, so that updates to " + + f"{_package_label} can require the higher version, or " + + "(b) you manually update your Python environment to use at " + + f"least version {_next_supported_version} of " + + f"{_dependency_package}.", + FutureWarning, + ) + except Exception: + warnings.warn( + "Could not determine the version of Python " + + "currently being used. To continue receiving " + + "updates for {_package_label}, ensure you are " + + "using a supported version of Python; see " + + "https://devguide.python.org/versions/" + ) + __all__ = ( "InstanceAdminAsyncClient", "AutoscalingConfig", diff --git a/google/cloud/spanner_admin_instance_v1/gapic_version.py b/google/cloud/spanner_admin_instance_v1/gapic_version.py index 992322a033..d231182458 100644 --- a/google/cloud/spanner_admin_instance_v1/gapic_version.py +++ b/google/cloud/spanner_admin_instance_v1/gapic_version.py @@ -13,4 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + __version__ = "3.60.0" # {x-release-please-version} diff --git a/google/cloud/spanner_admin_instance_v1/py.typed b/google/cloud/spanner_admin_instance_v1/py.typed index 915a8e55e3..0699ae5083 100644 --- a/google/cloud/spanner_admin_instance_v1/py.typed +++ b/google/cloud/spanner_admin_instance_v1/py.typed @@ -1,2 +1,6 @@ # Marker file for PEP 561. # The google-cloud-spanner-admin-instance package uses inline types. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + diff --git a/google/cloud/spanner_admin_instance_v1/services/__init__.py b/google/cloud/spanner_admin_instance_v1/services/__init__.py index cbf94b283c..830ba96006 100644 --- a/google/cloud/spanner_admin_instance_v1/services/__init__.py +++ b/google/cloud/spanner_admin_instance_v1/services/__init__.py @@ -13,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py index 51df22ca2e..216382c1f8 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .client import InstanceAdminClient from .async_client import InstanceAdminAsyncClient diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py index 1e87fc5a63..36845c66cf 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging as std_logging from collections import OrderedDict import re diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py index c0fe398c3a..05f952e959 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from http import HTTPStatus import json @@ -178,6 +182,34 @@ def _get_default_mtls_endpoint(api_endpoint): _DEFAULT_ENDPOINT_TEMPLATE = "spanner.{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 @@ -402,12 +434,8 @@ def get_mtls_endpoint_and_cert_source( ) if client_options is None: client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_client_cert = InstanceAdminClient._use_client_cert_effective() use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" @@ -415,7 +443,7 @@ def get_mtls_endpoint_and_cert_source( # Figure out the client cert source to use. client_cert_source = None - if use_client_cert == "true": + 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(): @@ -447,20 +475,14 @@ def _read_environment_variables(): google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT is not any of ["auto", "never", "always"]. """ - use_client_cert = os.getenv( - "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" - ).lower() + use_client_cert = InstanceAdminClient._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_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + return use_client_cert, use_mtls_endpoint, universe_domain_env @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py index d4a3dde6d8..7291a6579c 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + 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 diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/README.rst b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/README.rst index 762ac0c765..dd9cf06024 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/README.rst +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/README.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + transport inheritance structure _______________________________ diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py index 24e71739c7..4813277c13 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from typing import Dict, Type diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py index d8c055d60e..eba67e3eb7 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py index 844a86fcc0..835bdf1a3f 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json import logging as std_logging import pickle diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py index e6d2e48cb3..2a99c22cbf 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import inspect import json import pickle diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py index feef4e8048..e59bd4b606 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging import json # type: ignore diff --git a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py index bf41644213..7b712af02d 100644 --- a/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py +++ b/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json # type: ignore from google.api_core import path_template from google.api_core import gapic_v1 diff --git a/google/cloud/spanner_admin_instance_v1/types/__init__.py b/google/cloud/spanner_admin_instance_v1/types/__init__.py index 9bd2de3e47..d9d7d44d70 100644 --- a/google/cloud/spanner_admin_instance_v1/types/__init__.py +++ b/google/cloud/spanner_admin_instance_v1/types/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .common import ( OperationProgress, ReplicaSelection, diff --git a/google/cloud/spanner_admin_instance_v1/types/common.py b/google/cloud/spanner_admin_instance_v1/types/common.py index 548e61c38e..843adce5d9 100644 --- a/google/cloud/spanner_admin_instance_v1/types/common.py +++ b/google/cloud/spanner_admin_instance_v1/types/common.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py b/google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py index be1822b33c..970793c75f 100644 --- a/google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py +++ b/google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/gapic_version.py b/google/cloud/spanner_v1/gapic_version.py index 992322a033..d231182458 100644 --- a/google/cloud/spanner_v1/gapic_version.py +++ b/google/cloud/spanner_v1/gapic_version.py @@ -13,4 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + __version__ = "3.60.0" # {x-release-please-version} diff --git a/google/cloud/spanner_v1/py.typed b/google/cloud/spanner_v1/py.typed index 0989eccd04..c4ccdf7d5e 100644 --- a/google/cloud/spanner_v1/py.typed +++ b/google/cloud/spanner_v1/py.typed @@ -1,2 +1,6 @@ # Marker file for PEP 561. # The google-cloud-spanner package uses inline types. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + diff --git a/google/cloud/spanner_v1/services/__init__.py b/google/cloud/spanner_v1/services/__init__.py index cbf94b283c..830ba96006 100644 --- a/google/cloud/spanner_v1/services/__init__.py +++ b/google/cloud/spanner_v1/services/__init__.py @@ -13,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` diff --git a/google/cloud/spanner_v1/services/spanner/__init__.py b/google/cloud/spanner_v1/services/spanner/__init__.py index 3af41fdc08..9507973402 100644 --- a/google/cloud/spanner_v1/services/spanner/__init__.py +++ b/google/cloud/spanner_v1/services/spanner/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .client import SpannerClient from .async_client import SpannerAsyncClient diff --git a/google/cloud/spanner_v1/services/spanner/async_client.py b/google/cloud/spanner_v1/services/spanner/async_client.py index b197172a8a..081358fa5e 100644 --- a/google/cloud/spanner_v1/services/spanner/async_client.py +++ b/google/cloud/spanner_v1/services/spanner/async_client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging as std_logging from collections import OrderedDict import re diff --git a/google/cloud/spanner_v1/services/spanner/client.py b/google/cloud/spanner_v1/services/spanner/client.py index d542dd89ef..b802d1aa75 100644 --- a/google/cloud/spanner_v1/services/spanner/client.py +++ b/google/cloud/spanner_v1/services/spanner/client.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from http import HTTPStatus import json @@ -160,6 +164,34 @@ def _get_default_mtls_endpoint(api_endpoint): _DEFAULT_ENDPOINT_TEMPLATE = "spanner.{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 @@ -371,12 +403,8 @@ def get_mtls_endpoint_and_cert_source( ) if client_options is None: client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_client_cert = SpannerClient._use_client_cert_effective() use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" @@ -384,7 +412,7 @@ def get_mtls_endpoint_and_cert_source( # Figure out the client cert source to use. client_cert_source = None - if use_client_cert == "true": + 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(): @@ -416,20 +444,14 @@ def _read_environment_variables(): google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT is not any of ["auto", "never", "always"]. """ - use_client_cert = os.getenv( - "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" - ).lower() + use_client_cert = SpannerClient._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_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) if use_mtls_endpoint not in ("auto", "never", "always"): raise MutualTLSChannelError( "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + return use_client_cert, use_mtls_endpoint, universe_domain_env @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): diff --git a/google/cloud/spanner_v1/services/spanner/pagers.py b/google/cloud/spanner_v1/services/spanner/pagers.py index 90927b54ee..22172b9b55 100644 --- a/google/cloud/spanner_v1/services/spanner/pagers.py +++ b/google/cloud/spanner_v1/services/spanner/pagers.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + 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 diff --git a/google/cloud/spanner_v1/services/spanner/transports/README.rst b/google/cloud/spanner_v1/services/spanner/transports/README.rst index 99997401d5..cd64cd4b6c 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/README.rst +++ b/google/cloud/spanner_v1/services/spanner/transports/README.rst @@ -1,3 +1,6 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + transport inheritance structure _______________________________ diff --git a/google/cloud/spanner_v1/services/spanner/transports/__init__.py b/google/cloud/spanner_v1/services/spanner/transports/__init__.py index 4442420c7f..4a6ad49f37 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/__init__.py +++ b/google/cloud/spanner_v1/services/spanner/transports/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from collections import OrderedDict from typing import Dict, Type diff --git a/google/cloud/spanner_v1/services/spanner/transports/base.py b/google/cloud/spanner_v1/services/spanner/transports/base.py index 3e68439cd7..441a32d007 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/base.py +++ b/google/cloud/spanner_v1/services/spanner/transports/base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union diff --git a/google/cloud/spanner_v1/services/spanner/transports/grpc.py b/google/cloud/spanner_v1/services/spanner/transports/grpc.py index 0d0613152f..a961405941 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/grpc.py +++ b/google/cloud/spanner_v1/services/spanner/transports/grpc.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json import logging as std_logging import pickle diff --git a/google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py b/google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py index 4f492c7f44..11d3354816 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py +++ b/google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import inspect import json import pickle diff --git a/google/cloud/spanner_v1/services/spanner/transports/rest.py b/google/cloud/spanner_v1/services/spanner/transports/rest.py index 721e9929b3..a7fa4036ca 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/rest.py +++ b/google/cloud/spanner_v1/services/spanner/transports/rest.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import logging import json # type: ignore diff --git a/google/cloud/spanner_v1/services/spanner/transports/rest_base.py b/google/cloud/spanner_v1/services/spanner/transports/rest_base.py index e93f5d4b58..7980d8e8d6 100644 --- a/google/cloud/spanner_v1/services/spanner/transports/rest_base.py +++ b/google/cloud/spanner_v1/services/spanner/transports/rest_base.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import json # type: ignore from google.api_core import path_template from google.api_core import gapic_v1 diff --git a/google/cloud/spanner_v1/types/__init__.py b/google/cloud/spanner_v1/types/__init__.py index 5a7ded16dd..9a3d8f6689 100644 --- a/google/cloud/spanner_v1/types/__init__.py +++ b/google/cloud/spanner_v1/types/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from .change_stream import ( ChangeStreamRecord, ) diff --git a/google/cloud/spanner_v1/types/change_stream.py b/google/cloud/spanner_v1/types/change_stream.py index 762fc6a5d5..12451123cd 100644 --- a/google/cloud/spanner_v1/types/change_stream.py +++ b/google/cloud/spanner_v1/types/change_stream.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/commit_response.py b/google/cloud/spanner_v1/types/commit_response.py index 8214973e5a..4eaa503e82 100644 --- a/google/cloud/spanner_v1/types/commit_response.py +++ b/google/cloud/spanner_v1/types/commit_response.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/keys.py b/google/cloud/spanner_v1/types/keys.py index 15272ab689..d89dc685e0 100644 --- a/google/cloud/spanner_v1/types/keys.py +++ b/google/cloud/spanner_v1/types/keys.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/location.py b/google/cloud/spanner_v1/types/location.py index 1749e87aef..c4aeb28fb4 100644 --- a/google/cloud/spanner_v1/types/location.py +++ b/google/cloud/spanner_v1/types/location.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/mutation.py b/google/cloud/spanner_v1/types/mutation.py index 3cbc3b937b..a724984a23 100644 --- a/google/cloud/spanner_v1/types/mutation.py +++ b/google/cloud/spanner_v1/types/mutation.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/query_plan.py b/google/cloud/spanner_v1/types/query_plan.py index efe32934f8..6c405a198c 100644 --- a/google/cloud/spanner_v1/types/query_plan.py +++ b/google/cloud/spanner_v1/types/query_plan.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/result_set.py b/google/cloud/spanner_v1/types/result_set.py index 0ab386bc61..bd7effb7d6 100644 --- a/google/cloud/spanner_v1/types/result_set.py +++ b/google/cloud/spanner_v1/types/result_set.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/spanner.py b/google/cloud/spanner_v1/types/spanner.py index 6e363088de..23e43ce040 100644 --- a/google/cloud/spanner_v1/types/spanner.py +++ b/google/cloud/spanner_v1/types/spanner.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/transaction.py b/google/cloud/spanner_v1/types/transaction.py index 0cc11a73a6..0da96b5d97 100644 --- a/google/cloud/spanner_v1/types/transaction.py +++ b/google/cloud/spanner_v1/types/transaction.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/google/cloud/spanner_v1/types/type.py b/google/cloud/spanner_v1/types/type.py index d6d516569e..c8d087a78f 100644 --- a/google/cloud/spanner_v1/types/type.py +++ b/google/cloud/spanner_v1/types/type.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + from __future__ import annotations from typing import MutableMapping, MutableSequence diff --git a/noxfile.py b/noxfile.py index 82715de072..17f5bc32f0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,6 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import @@ -35,7 +39,7 @@ DEFAULT_PYTHON_VERSION = "3.14" DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12" -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.14"] +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"] UNIT_TEST_PYTHON_VERSIONS: List[str] = [ "3.9", @@ -43,7 +47,6 @@ "3.11", "3.12", "3.13", - "3.14", ] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", @@ -82,7 +85,6 @@ "unit-3.11", "unit-3.12", "unit-3.13", - "unit-3.14", "system", "cover", "lint", @@ -220,7 +222,6 @@ def unit(session, protobuf_implementation): session.run( "py.test", "--quiet", - "-s", f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google", "--cov=tests/unit", @@ -483,7 +484,7 @@ def docfx(session): ) -@nox.session(python="3.14") +@nox.session(python="3.13") @nox.parametrize( "protobuf_implementation,database_dialect", [ diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_async.py index ff6fcfe598..aed735927c 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_sync.py index 3819bbe986..36ddcf3440 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_add_split_points_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_async.py index d885947bb5..453075aaf7 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_sync.py index a571e058c9..2f327c22ae 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_copy_backup_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_async.py index 2ad8881f54..39faffcaaf 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_async.py index efdcc2457e..21d08593f2 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_sync.py index 60d4b50c3b..2a139c478b 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_schedule_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_sync.py index 02b9d1f0e7..84928f4653 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_backup_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py index 47399a8d40..20d84eb4e2 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_create_database_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_create_database_sync.py index 6f112cd8a7..d218bec451 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_create_database_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_create_database_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_async.py index ab10785105..888f4ac433 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_async.py index 591d45cb10..6b4b73adee 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_sync.py index 720417ba65..3a0b19ab8f 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_schedule_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_sync.py index 736dc56a23..e1db17d9b8 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_delete_backup_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_async.py index 15f279b72d..b632a35192 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_sync.py index f218cabd83..8471a0a13d 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_drop_database_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_async.py index 58b93a119a..cce6935d96 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_async.py index 5a37eec975..3de6ed5ac2 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_sync.py index 4006cac333..4c9cb0d23b 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_schedule_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_sync.py index 16cffcd78d..adc17d5085 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_backup_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_async.py index fd8621c27b..730601809c 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_async.py index 8e84b21f78..6518848e8c 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_sync.py index 495b557a55..c4b2a41f94 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_ddl_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_sync.py index ab729bb9e3..9f946473ad 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_database_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_database_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_async.py index d5d75de78b..98ea45ea0e 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_sync.py index 75e0b48b1b..69af2294e1 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_get_iam_policy_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_async.py index 556205a0aa..15ff62dd46 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_sync.py index 46f1a3c88f..ea1f1b0b55 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_internal_update_graph_operation_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_async.py index a56ec9f80e..51c70008ba 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_sync.py index 6383e1b247..4b0cb63462 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_operations_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_async.py index 25ac53891a..6b5d8c60f9 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_sync.py index 89cf82d278..49d3e5ddc5 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backup_schedules_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_async.py index 140e519e07..9cb9e05850 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_sync.py index 9f04036f74..3cd0c8453f 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_backups_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_async.py index 3bc614b232..4e1cad8fa9 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_sync.py index 3d4dc965a9..8a0f4fd5a4 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_operations_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_async.py index 46ec91ce89..a66232c1f7 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_sync.py index d39e4759dd..7ac6c7f1a6 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_database_roles_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_async.py index 586dfa56f1..d4e9c08cc5 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_sync.py index e6ef221af6..9a6440a970 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_list_databases_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_async.py index 384c063c61..d45bd39bf7 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_sync.py index a327a8ae13..741198065e 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_restore_database_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_async.py index edade4c950..e690e4dd26 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_sync.py index 28a6746f4a..830f80b244 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_set_iam_policy_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_async.py index 0e6ea91cb3..70901a84dd 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_sync.py index 3fd0316dc1..b40c30490f 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_test_iam_permissions_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_async.py index 95fa2a63f6..d1ee851532 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_async.py index de17dfc86e..d930e701f5 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_sync.py index 4ef64a0673..605f331d14 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_schedule_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_sync.py index 9dbb0148dc..60acaecd69 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_backup_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_async.py index d5588c3036..0189b010f7 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_async.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_async.py index ad98e2da9c..a068b7fd1a 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_async.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_sync.py index 73297524b9..f4f228b6d8 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_ddl_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_sync.py b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_sync.py index 62ed40bc84..df72a82342 100644 --- a/samples/generated_samples/spanner_v1_generated_database_admin_update_database_sync.py +++ b/samples/generated_samples/spanner_v1_generated_database_admin_update_database_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-database diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_async.py index 74bd640044..bdda76a8ea 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_async.py index c3f266e4c4..89f04f470e 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_sync.py index c5b7616534..709e97cba3 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_config_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_async.py index a22765f53f..358d4afca3 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_sync.py index 5b5f2e0e26..f327acf855 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_partition_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_sync.py index f43c5016b5..249e06de3b 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_create_instance_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_async.py index 262da709aa..445c49c292 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_async.py index df83d9e424..ea5934b720 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_sync.py index 9a9c4d7ca1..0ed6a1f87b 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_config_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_async.py index 78ca44d6c2..5ccdafa7c0 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_sync.py index 72249ef6c7..3df334f616 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_partition_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_sync.py index 613ac6c070..5b8df05e77 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_delete_instance_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_async.py index a0b620ae4f..23a0d4b051 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_sync.py index cc0d725a03..d0ef62f1b7 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_iam_policy_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_async.py index 059eb2a078..7934f0b9bf 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_async.py index 9adfb51c2e..20351a16a5 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_sync.py index 16e9d3c3c8..3aa5c2a6fc 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_config_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_async.py index 8e84abcf6e..0d8901570e 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_sync.py index d617cbb382..567dfa6817 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_partition_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_sync.py index 4a246a5bf3..8e19c2e401 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_get_instance_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_async.py index a0580fef7c..e811da61eb 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_sync.py index 89213b3a2e..653bdc4ed1 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_config_operations_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_async.py index 651b2f88ae..8aa36622cc 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_sync.py index a0f120277a..7cd5dcc5d2 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_configs_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_async.py index 9dedb973f1..38bcdf9d6a 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_sync.py index b2a7549b29..f08b4c4738 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partition_operations_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_async.py index 56adc152fe..2c2585f74f 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_sync.py index 1e65552fc1..3bf1fc62da 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instance_partitions_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_async.py index abe1a1affa..aa511daa57 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_sync.py index f344baff11..114c496c7b 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_list_instances_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_async.py index ce62120492..ce1bd51d5a 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_sync.py index 4621200e0c..cfc66b009d 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_move_instance_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_async.py index 2443f2127d..d6b6ef1b69 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_sync.py index ba6401602f..b586df6b67 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_set_iam_policy_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_async.py index aa0e05dde3..daed6b1a85 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_sync.py index 80b2a4dd21..37e730b565 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_test_iam_permissions_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_async.py index ecabbf5191..ed81e4c984 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_async.py index f7ea78401c..95d7c0d208 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_sync.py index 1d184f6c58..e8f524f4ea 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_config_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_async.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_async.py index 42d3c484f8..6556988079 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_async.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_sync.py index 56cd2760a1..fc6b95fcef 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_partition_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_sync.py b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_sync.py index 2340e701e1..e3239df20f 100644 --- a/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_sync.py +++ b/samples/generated_samples/spanner_v1_generated_instance_admin_update_instance_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner-admin-instance diff --git a/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_async.py b/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_async.py index 49e64b4ab8..8fd0ef7842 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_sync.py index ade1da3661..0cce12b6f4 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_batch_create_sessions_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_batch_write_async.py b/samples/generated_samples/spanner_v1_generated_spanner_batch_write_async.py index d1565657e8..7e804e8dff 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_batch_write_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_batch_write_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_batch_write_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_batch_write_sync.py index 9b6621def9..3efacb7366 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_batch_write_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_batch_write_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_async.py b/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_async.py index efdd161715..b953b731f1 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_sync.py index 764dab8aa2..0d6ac33af3 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_begin_transaction_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_commit_async.py b/samples/generated_samples/spanner_v1_generated_spanner_commit_async.py index f61c297d38..017f8d9beb 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_commit_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_commit_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_commit_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_commit_sync.py index a945bd2234..545e5e5bd8 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_commit_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_commit_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_create_session_async.py b/samples/generated_samples/spanner_v1_generated_spanner_create_session_async.py index 8cddc00c66..d05083187b 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_create_session_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_create_session_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_create_session_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_create_session_sync.py index b9de2d34e0..a076d108b7 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_create_session_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_create_session_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_delete_session_async.py b/samples/generated_samples/spanner_v1_generated_spanner_delete_session_async.py index 9fed1ddca6..cba38bec41 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_delete_session_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_delete_session_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_delete_session_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_delete_session_sync.py index 1f2a17e2d1..781ece9c92 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_delete_session_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_delete_session_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_async.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_async.py index 8313fd66a0..1b3666f5dc 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_sync.py index dd4696b6b2..481a936799 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_batch_dml_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_async.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_async.py index a12b20f3e9..bc59849f99 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_sync.py index 761d0ca251..fa9e2aea04 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_sql_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_async.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_async.py index 86b8eb910e..d758f7240c 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_sync.py index dc7dba43b8..de82189c84 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_execute_streaming_sql_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_get_session_async.py b/samples/generated_samples/spanner_v1_generated_spanner_get_session_async.py index d2e50f9891..eca48d7694 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_get_session_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_get_session_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_get_session_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_get_session_sync.py index 36d6436b04..d9d0b4fd27 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_get_session_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_get_session_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_async.py b/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_async.py index 95aa4bf818..3dc29a26d2 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_sync.py index a9533fed0d..65cf249310 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_list_sessions_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_partition_query_async.py b/samples/generated_samples/spanner_v1_generated_spanner_partition_query_async.py index 200fb2f6a2..5e98f2b5d0 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_partition_query_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_partition_query_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_partition_query_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_partition_query_sync.py index d486a3590c..737a517373 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_partition_query_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_partition_query_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_partition_read_async.py b/samples/generated_samples/spanner_v1_generated_spanner_partition_read_async.py index 99055ade8b..5ad909ee9e 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_partition_read_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_partition_read_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_partition_read_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_partition_read_sync.py index 0ca01ac423..03e1beae3b 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_partition_read_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_partition_read_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_read_async.py b/samples/generated_samples/spanner_v1_generated_spanner_read_async.py index e555865245..95394bf8ef 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_read_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_read_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_read_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_read_sync.py index 8f9ee621f3..f2ec7a5425 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_read_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_read_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_rollback_async.py b/samples/generated_samples/spanner_v1_generated_spanner_rollback_async.py index f99a1b8dd8..3a5dd47ff3 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_rollback_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_rollback_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_rollback_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_rollback_sync.py index 00b23b21fc..a1b4b47166 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_rollback_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_rollback_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_async.py b/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_async.py index f79b9a96a1..8208b8c7b2 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_async.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_async.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_sync.py b/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_sync.py index f81ed34b33..5abc12d506 100644 --- a/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_sync.py +++ b/samples/generated_samples/spanner_v1_generated_spanner_streaming_read_sync.py @@ -19,6 +19,10 @@ # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment. +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-spanner diff --git a/scripts/fixup_spanner_admin_database_v1_keywords.py b/scripts/fixup_spanner_admin_database_v1_keywords.py deleted file mode 100644 index d642e9a0e3..0000000000 --- a/scripts/fixup_spanner_admin_database_v1_keywords.py +++ /dev/null @@ -1,202 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class spanner_admin_databaseCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'add_split_points': ('database', 'split_points', 'initiator', ), - 'copy_backup': ('parent', 'backup_id', 'source_backup', 'expire_time', 'encryption_config', ), - 'create_backup': ('parent', 'backup_id', 'backup', 'encryption_config', ), - 'create_backup_schedule': ('parent', 'backup_schedule_id', 'backup_schedule', ), - 'create_database': ('parent', 'create_statement', 'extra_statements', 'encryption_config', 'database_dialect', 'proto_descriptors', ), - 'delete_backup': ('name', ), - 'delete_backup_schedule': ('name', ), - 'drop_database': ('database', ), - 'get_backup': ('name', ), - 'get_backup_schedule': ('name', ), - 'get_database': ('name', ), - 'get_database_ddl': ('database', ), - 'get_iam_policy': ('resource', 'options', ), - 'internal_update_graph_operation': ('database', 'operation_id', 'vm_identity_token', 'progress', 'status', ), - 'list_backup_operations': ('parent', 'filter', 'page_size', 'page_token', ), - 'list_backups': ('parent', 'filter', 'page_size', 'page_token', ), - 'list_backup_schedules': ('parent', 'page_size', 'page_token', ), - 'list_database_operations': ('parent', 'filter', 'page_size', 'page_token', ), - 'list_database_roles': ('parent', 'page_size', 'page_token', ), - 'list_databases': ('parent', 'page_size', 'page_token', ), - 'restore_database': ('parent', 'database_id', 'backup', 'encryption_config', ), - 'set_iam_policy': ('resource', 'policy', 'update_mask', ), - 'test_iam_permissions': ('resource', 'permissions', ), - 'update_backup': ('backup', 'update_mask', ), - 'update_backup_schedule': ('backup_schedule', 'update_mask', ), - 'update_database': ('database', 'update_mask', ), - 'update_database_ddl': ('database', 'statements', 'operation_id', 'proto_descriptors', 'throughput_mode', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=spanner_admin_databaseCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the spanner_admin_database client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/scripts/fixup_spanner_admin_instance_v1_keywords.py b/scripts/fixup_spanner_admin_instance_v1_keywords.py deleted file mode 100644 index 8200af5099..0000000000 --- a/scripts/fixup_spanner_admin_instance_v1_keywords.py +++ /dev/null @@ -1,196 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class spanner_admin_instanceCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'create_instance': ('parent', 'instance_id', 'instance', ), - 'create_instance_config': ('parent', 'instance_config_id', 'instance_config', 'validate_only', ), - 'create_instance_partition': ('parent', 'instance_partition_id', 'instance_partition', ), - 'delete_instance': ('name', ), - 'delete_instance_config': ('name', 'etag', 'validate_only', ), - 'delete_instance_partition': ('name', 'etag', ), - 'get_iam_policy': ('resource', 'options', ), - 'get_instance': ('name', 'field_mask', ), - 'get_instance_config': ('name', ), - 'get_instance_partition': ('name', ), - 'list_instance_config_operations': ('parent', 'filter', 'page_size', 'page_token', ), - 'list_instance_configs': ('parent', 'page_size', 'page_token', ), - 'list_instance_partition_operations': ('parent', 'filter', 'page_size', 'page_token', 'instance_partition_deadline', ), - 'list_instance_partitions': ('parent', 'page_size', 'page_token', 'instance_partition_deadline', ), - 'list_instances': ('parent', 'page_size', 'page_token', 'filter', 'instance_deadline', ), - 'move_instance': ('name', 'target_config', ), - 'set_iam_policy': ('resource', 'policy', 'update_mask', ), - 'test_iam_permissions': ('resource', 'permissions', ), - 'update_instance': ('instance', 'field_mask', ), - 'update_instance_config': ('instance_config', 'update_mask', 'validate_only', ), - 'update_instance_partition': ('instance_partition', 'field_mask', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=spanner_admin_instanceCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the spanner_admin_instance client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/scripts/fixup_spanner_v1_keywords.py b/scripts/fixup_spanner_v1_keywords.py deleted file mode 100644 index e0787f13b4..0000000000 --- a/scripts/fixup_spanner_v1_keywords.py +++ /dev/null @@ -1,191 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class spannerCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'batch_create_sessions': ('database', 'session_count', 'session_template', ), - 'batch_write': ('session', 'mutation_groups', 'request_options', 'exclude_txn_from_change_streams', ), - 'begin_transaction': ('session', 'options', 'request_options', 'mutation_key', ), - 'commit': ('session', 'transaction_id', 'single_use_transaction', 'mutations', 'return_commit_stats', 'max_commit_delay', 'request_options', 'precommit_token', ), - 'create_session': ('database', 'session', ), - 'delete_session': ('name', ), - 'execute_batch_dml': ('session', 'transaction', 'statements', 'seqno', 'request_options', 'last_statements', ), - 'execute_sql': ('session', 'sql', 'transaction', 'params', 'param_types', 'resume_token', 'query_mode', 'partition_token', 'seqno', 'query_options', 'request_options', 'directed_read_options', 'data_boost_enabled', 'last_statement', 'routing_hint', ), - 'execute_streaming_sql': ('session', 'sql', 'transaction', 'params', 'param_types', 'resume_token', 'query_mode', 'partition_token', 'seqno', 'query_options', 'request_options', 'directed_read_options', 'data_boost_enabled', 'last_statement', 'routing_hint', ), - 'get_session': ('name', ), - 'list_sessions': ('database', 'page_size', 'page_token', 'filter', ), - 'partition_query': ('session', 'sql', 'transaction', 'params', 'param_types', 'partition_options', ), - 'partition_read': ('session', 'table', 'key_set', 'transaction', 'index', 'columns', 'partition_options', ), - 'read': ('session', 'table', 'columns', 'key_set', 'transaction', 'index', 'limit', 'resume_token', 'partition_token', 'request_options', 'directed_read_options', 'data_boost_enabled', 'order_by', 'lock_hint', 'routing_hint', ), - 'rollback': ('session', 'transaction_id', ), - 'streaming_read': ('session', 'table', 'columns', 'key_set', 'transaction', 'index', 'limit', 'resume_token', 'partition_token', 'request_options', 'directed_read_options', 'data_boost_enabled', 'order_by', 'lock_hint', 'routing_hint', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=spannerCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the spanner client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/setup.py b/setup.py index fdd911bfd1..f85006eda0 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import io import os @@ -44,15 +48,18 @@ "proto-plus >= 1.22.2, <2.0.0; python_version>='3.11'", "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-interceptor >= 0.15.4", - # Make OpenTelemetry a core dependency - "opentelemetry-api >= 1.22.0", - "opentelemetry-sdk >= 1.22.0", - "opentelemetry-semantic-conventions >= 0.43b0", - "opentelemetry-resourcedetector-gcp >= 1.8.0a0", - "google-cloud-monitoring >= 2.16.0", - "mmh3 >= 4.1.0 ", ] -extras = {"libcst": "libcst >= 0.2.5"} +extras = { + "tracing": [ + "opentelemetry-api >= 1.22.0", + "opentelemetry-sdk >= 1.22.0", + "opentelemetry-semantic-conventions >= 0.43b0", + "opentelemetry-resourcedetector-gcp >= 1.8.0a0", + "google-cloud-monitoring >= 2.16.0", + "mmh3 >= 4.1.0 ", + ], + "libcst": "libcst >= 0.2.5", +} url = "https://github.com/googleapis/python-spanner" @@ -87,7 +94,6 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index ef1c92ffff..a051f7ed08 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -1,9 +1,12 @@ # -*- coding: utf-8 -*- # This constraints file is required for unit tests. # List all library dependencies and extras in this file. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core google-auth grpcio proto-plus protobuf -grpc-google-iam-v1 diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index ef1c92ffff..a051f7ed08 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -1,9 +1,12 @@ # -*- coding: utf-8 -*- # This constraints file is required for unit tests. # List all library dependencies and extras in this file. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core google-auth grpcio proto-plus protobuf -grpc-google-iam-v1 diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt index ef1c92ffff..a051f7ed08 100644 --- a/testing/constraints-3.12.txt +++ b/testing/constraints-3.12.txt @@ -1,9 +1,12 @@ # -*- coding: utf-8 -*- # This constraints file is required for unit tests. # List all library dependencies and extras in this file. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core google-auth grpcio proto-plus protobuf -grpc-google-iam-v1 diff --git a/testing/constraints-3.13.txt b/testing/constraints-3.13.txt index 2ae5a677e8..d672dd9aa9 100644 --- a/testing/constraints-3.13.txt +++ b/testing/constraints-3.13.txt @@ -5,9 +5,12 @@ # Require the latest major version be installed for each dependency. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", # Then this file should have google-cloud-foo>=1 + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core>=2 google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -grpc-google-iam-v1>=0 diff --git a/testing/constraints-3.14.txt b/testing/constraints-3.14.txt index 92054fc895..d672dd9aa9 100644 --- a/testing/constraints-3.14.txt +++ b/testing/constraints-3.14.txt @@ -5,9 +5,12 @@ # Require the latest major version be installed for each dependency. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", # Then this file should have google-cloud-foo>=1 + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core>=2 google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -grpc-google-iam-v1>=0 \ No newline at end of file diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index ef1c92ffff..a051f7ed08 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -1,9 +1,12 @@ # -*- coding: utf-8 -*- # This constraints file is required for unit tests. # List all library dependencies and extras in this file. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core google-auth grpcio proto-plus protobuf -grpc-google-iam-v1 diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index ef1c92ffff..a051f7ed08 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -1,9 +1,12 @@ # -*- coding: utf-8 -*- # This constraints file is required for unit tests. # List all library dependencies and extras in this file. + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + google-api-core google-auth grpcio proto-plus protobuf -grpc-google-iam-v1 diff --git a/tests/__init__.py b/tests/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/gapic/spanner_admin_database_v1/__init__.py b/tests/unit/gapic/spanner_admin_database_v1/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/unit/gapic/spanner_admin_database_v1/__init__.py +++ b/tests/unit/gapic/spanner_admin_database_v1/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py b/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py index e210da1d37..f5689f52bf 100644 --- a/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py +++ b/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import os import re @@ -184,12 +188,19 @@ def test__read_environment_variables(): with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): - with pytest.raises(ValueError) as excinfo: - DatabaseAdminClient._read_environment_variables() - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with pytest.raises(ValueError) as excinfo: + DatabaseAdminClient._read_environment_variables() + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + else: + assert DatabaseAdminClient._read_environment_variables() == ( + False, + "auto", + None, + ) with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): assert DatabaseAdminClient._read_environment_variables() == ( @@ -228,6 +239,105 @@ def test__read_environment_variables(): ) +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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._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): + DatabaseAdminClient._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 DatabaseAdminClient._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 DatabaseAdminClient._use_client_cert_effective() is False + + def test__get_client_cert_source(): mock_provided_cert_source = mock.Mock() mock_default_cert_source = mock.Mock() @@ -593,17 +703,6 @@ def test_database_admin_client_client_options( == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client = client_class(transport=transport_name) - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - # 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: @@ -819,6 +918,119 @@ def test_database_admin_client_get_mtls_endpoint_and_cert_source(client_class): 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() @@ -869,18 +1081,6 @@ def test_database_admin_client_get_mtls_endpoint_and_cert_source(client_class): == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - @pytest.mark.parametrize( "client_class", [DatabaseAdminClient, DatabaseAdminAsyncClient] @@ -23552,6 +23752,7 @@ def test_database_admin_grpc_asyncio_transport_channel(): # 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", [ diff --git a/tests/unit/gapic/spanner_admin_instance_v1/__init__.py b/tests/unit/gapic/spanner_admin_instance_v1/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/unit/gapic/spanner_admin_instance_v1/__init__.py +++ b/tests/unit/gapic/spanner_admin_instance_v1/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py b/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py index 532014af96..f47b426d1e 100644 --- a/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py +++ b/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import os import re @@ -173,12 +177,19 @@ def test__read_environment_variables(): with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): - with pytest.raises(ValueError) as excinfo: - InstanceAdminClient._read_environment_variables() - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with pytest.raises(ValueError) as excinfo: + InstanceAdminClient._read_environment_variables() + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + else: + assert InstanceAdminClient._read_environment_variables() == ( + False, + "auto", + None, + ) with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): assert InstanceAdminClient._read_environment_variables() == ( @@ -217,6 +228,105 @@ def test__read_environment_variables(): ) +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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._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): + InstanceAdminClient._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 InstanceAdminClient._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 InstanceAdminClient._use_client_cert_effective() is False + + def test__get_client_cert_source(): mock_provided_cert_source = mock.Mock() mock_default_cert_source = mock.Mock() @@ -582,17 +692,6 @@ def test_instance_admin_client_client_options( == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client = client_class(transport=transport_name) - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - # 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: @@ -808,6 +907,119 @@ def test_instance_admin_client_get_mtls_endpoint_and_cert_source(client_class): 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() @@ -858,18 +1070,6 @@ def test_instance_admin_client_get_mtls_endpoint_and_cert_source(client_class): == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - @pytest.mark.parametrize( "client_class", [InstanceAdminClient, InstanceAdminAsyncClient] @@ -18840,6 +19040,7 @@ def test_instance_admin_grpc_asyncio_transport_channel(): # 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", [ diff --git a/tests/unit/gapic/spanner_v1/__init__.py b/tests/unit/gapic/spanner_v1/__init__.py index cbf94b283c..a352d758d6 100644 --- a/tests/unit/gapic/spanner_v1/__init__.py +++ b/tests/unit/gapic/spanner_v1/__init__.py @@ -1,3 +1,7 @@ +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + + # -*- coding: utf-8 -*- # Copyright 2025 Google LLC # diff --git a/tests/unit/gapic/spanner_v1/test_spanner.py b/tests/unit/gapic/spanner_v1/test_spanner.py index d71d85a443..587417bb71 100644 --- a/tests/unit/gapic/spanner_v1/test_spanner.py +++ b/tests/unit/gapic/spanner_v1/test_spanner.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input` +# The source of truth for this file is `.librarian/generator-input` + import os # try/except added for compatibility with python < 3.8 @@ -156,12 +160,19 @@ def test__read_environment_variables(): with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): - with pytest.raises(ValueError) as excinfo: - SpannerClient._read_environment_variables() - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) + if not hasattr(google.auth.transport.mtls, "should_use_client_cert"): + with pytest.raises(ValueError) as excinfo: + SpannerClient._read_environment_variables() + assert ( + str(excinfo.value) + == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + else: + assert SpannerClient._read_environment_variables() == ( + False, + "auto", + None, + ) with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): assert SpannerClient._read_environment_variables() == (False, "never", None) @@ -184,6 +195,105 @@ def test__read_environment_variables(): assert SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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 SpannerClient._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): + SpannerClient._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 SpannerClient._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 SpannerClient._use_client_cert_effective() is False + + def test__get_client_cert_source(): mock_provided_cert_source = mock.Mock() mock_default_cert_source = mock.Mock() @@ -539,17 +649,6 @@ def test_spanner_client_client_options(client_class, transport_class, transport_ == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client = client_class(transport=transport_name) - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - # 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: @@ -764,6 +863,119 @@ def test_spanner_client_get_mtls_endpoint_and_cert_source(client_class): 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() @@ -814,18 +1026,6 @@ def test_spanner_client_get_mtls_endpoint_and_cert_source(client_class): == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" ) - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert ( - str(excinfo.value) - == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - @pytest.mark.parametrize("client_class", [SpannerClient, SpannerAsyncClient]) @mock.patch.object( @@ -12382,6 +12582,7 @@ def test_spanner_grpc_asyncio_transport_channel(): # 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.SpannerGrpcTransport, transports.SpannerGrpcAsyncIOTransport],