Skip to content

Commit 6a5845d

Browse files
committed
revert dialogflow
1 parent 0e89db0 commit 6a5845d

87 files changed

Lines changed: 10190 additions & 1639 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-dialogflow-cx/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44

55
[1]: https://pypi.org/project/google-cloud-dialogflow-cx/#history
66

7+
## [2.2.0](https://github.com/googleapis/google-cloud-python/compare/google-cloud-dialogflow-cx-v2.1.0...google-cloud-dialogflow-cx-v2.2.0) (2026-01-08)
8+
9+
10+
### Features
11+
12+
* updated v3beta1 dialogflow client libraries ([17cc12897e6afdf3f3131531c50a8226a3f57c0f](https://github.com/googleapis/google-cloud-python/commit/17cc12897e6afdf3f3131531c50a8226a3f57c0f))
13+
* auto-enable mTLS when supported certificates are detected ([c353aa5bcc937ef9399c8efc90492dadbcf01aa2](https://github.com/googleapis/google-cloud-python/commit/c353aa5bcc937ef9399c8efc90492dadbcf01aa2))
14+
* check Python and dependency versions in generated GAPICs ([c353aa5bcc937ef9399c8efc90492dadbcf01aa2](https://github.com/googleapis/google-cloud-python/commit/c353aa5bcc937ef9399c8efc90492dadbcf01aa2))
15+
16+
## [2.1.0](https://github.com/googleapis/google-cloud-python/compare/google-cloud-dialogflow-cx-v2.0.0...google-cloud-dialogflow-cx-v2.1.0) (2025-12-04)
17+
18+
19+
### Features
20+
21+
* Service Account Auth in Tools and Webhooks ([03e69912a61695deefca6ffaae1add8119f026e4](https://github.com/googleapis/google-cloud-python/commit/03e69912a61695deefca6ffaae1add8119f026e4))
22+
* add support for defining custom actions in code. See https://cloud.google.com/dialogflow/cx/docs/concept/playbook/code-block for more information ([03e69912a61695deefca6ffaae1add8119f026e4](https://github.com/googleapis/google-cloud-python/commit/03e69912a61695deefca6ffaae1add8119f026e4))
23+
724
## [2.0.0](https://github.com/googleapis/google-cloud-python/compare/google-cloud-dialogflow-cx-v1.43.0...google-cloud-dialogflow-cx-v2.0.0) (2025-10-14)
825

926

packages/google-cloud-dialogflow-cx/google/cloud/dialogflowcx/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.0.0" # {x-release-please-version}
16+
__version__ = "2.2.0" # {x-release-please-version}

packages/google-cloud-dialogflow-cx/google/cloud/dialogflowcx_v3/__init__.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import sys
17+
18+
import google.api_core as api_core
19+
1620
from google.cloud.dialogflowcx_v3 import gapic_version as package_version
1721

1822
__version__ = package_version.__version__
1923

24+
if sys.version_info >= (3, 8): # pragma: NO COVER
25+
from importlib import metadata
26+
else: # pragma: NO COVER
27+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
28+
# this code path once we drop support for Python 3.7
29+
import importlib_metadata as metadata
2030

2131
from .services.agents import AgentsAsyncClient, AgentsClient
2232
from .services.changelogs import ChangelogsAsyncClient, ChangelogsClient
@@ -329,6 +339,100 @@
329339
WebhookResponse,
330340
)
331341

342+
if hasattr(api_core, "check_python_version") and hasattr(
343+
api_core, "check_dependency_versions"
344+
): # pragma: NO COVER
345+
api_core.check_python_version("google.cloud.dialogflowcx_v3") # type: ignore
346+
api_core.check_dependency_versions("google.cloud.dialogflowcx_v3") # type: ignore
347+
else: # pragma: NO COVER
348+
# An older version of api_core is installed which does not define the
349+
# functions above. We do equivalent checks manually.
350+
try:
351+
import sys
352+
import warnings
353+
354+
_py_version_str = sys.version.split()[0]
355+
_package_label = "google.cloud.dialogflowcx_v3"
356+
if sys.version_info < (3, 9):
357+
warnings.warn(
358+
"You are using a non-supported Python version "
359+
+ f"({_py_version_str}). Google will not post any further "
360+
+ f"updates to {_package_label} supporting this Python version. "
361+
+ "Please upgrade to the latest Python version, or at "
362+
+ f"least to Python 3.9, and then update {_package_label}.",
363+
FutureWarning,
364+
)
365+
if sys.version_info[:2] == (3, 9):
366+
warnings.warn(
367+
f"You are using a Python version ({_py_version_str}) "
368+
+ f"which Google will stop supporting in {_package_label} in "
369+
+ "January 2026. Please "
370+
+ "upgrade to the latest Python version, or at "
371+
+ "least to Python 3.10, before then, and "
372+
+ f"then update {_package_label}.",
373+
FutureWarning,
374+
)
375+
376+
def parse_version_to_tuple(version_string: str):
377+
"""Safely converts a semantic version string to a comparable tuple of integers.
378+
Example: "4.25.8" -> (4, 25, 8)
379+
Ignores non-numeric parts and handles common version formats.
380+
Args:
381+
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
382+
Returns:
383+
Tuple of integers for the parsed version string.
384+
"""
385+
parts = []
386+
for part in version_string.split("."):
387+
try:
388+
parts.append(int(part))
389+
except ValueError:
390+
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
391+
# This is a simplification compared to 'packaging.parse_version', but sufficient
392+
# for comparing strictly numeric semantic versions.
393+
break
394+
return tuple(parts)
395+
396+
def _get_version(dependency_name):
397+
try:
398+
version_string: str = metadata.version(dependency_name)
399+
parsed_version = parse_version_to_tuple(version_string)
400+
return (parsed_version, version_string)
401+
except Exception:
402+
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
403+
# or errors during parse_version_to_tuple
404+
return (None, "--")
405+
406+
_dependency_package = "google.protobuf"
407+
_next_supported_version = "4.25.8"
408+
_next_supported_version_tuple = (4, 25, 8)
409+
_recommendation = " (we recommend 6.x)"
410+
(_version_used, _version_used_string) = _get_version(_dependency_package)
411+
if _version_used and _version_used < _next_supported_version_tuple:
412+
warnings.warn(
413+
f"Package {_package_label} depends on "
414+
+ f"{_dependency_package}, currently installed at version "
415+
+ f"{_version_used_string}. Future updates to "
416+
+ f"{_package_label} will require {_dependency_package} at "
417+
+ f"version {_next_supported_version} or higher{_recommendation}."
418+
+ " Please ensure "
419+
+ "that either (a) your Python environment doesn't pin the "
420+
+ f"version of {_dependency_package}, so that updates to "
421+
+ f"{_package_label} can require the higher version, or "
422+
+ "(b) you manually update your Python environment to use at "
423+
+ f"least version {_next_supported_version} of "
424+
+ f"{_dependency_package}.",
425+
FutureWarning,
426+
)
427+
except Exception:
428+
warnings.warn(
429+
"Could not determine the version of Python "
430+
+ "currently being used. To continue receiving "
431+
+ "updates for {_package_label}, ensure you are "
432+
+ "using a supported version of Python; see "
433+
+ "https://devguide.python.org/versions/"
434+
)
435+
332436
__all__ = (
333437
"AgentsAsyncClient",
334438
"ChangelogsAsyncClient",

packages/google-cloud-dialogflow-cx/google/cloud/dialogflowcx_v3/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.0.0" # {x-release-please-version}
16+
__version__ = "2.2.0" # {x-release-please-version}

packages/google-cloud-dialogflow-cx/google/cloud/dialogflowcx_v3/services/agents/client.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,34 @@ def _get_default_mtls_endpoint(api_endpoint):
163163
_DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.{UNIVERSE_DOMAIN}"
164164
_DEFAULT_UNIVERSE = "googleapis.com"
165165

166+
@staticmethod
167+
def _use_client_cert_effective():
168+
"""Returns whether client certificate should be used for mTLS if the
169+
google-auth version supports should_use_client_cert automatic mTLS enablement.
170+
171+
Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
172+
173+
Returns:
174+
bool: whether client certificate should be used for mTLS
175+
Raises:
176+
ValueError: (If using a version of google-auth without should_use_client_cert and
177+
GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
178+
"""
179+
# check if google-auth version supports should_use_client_cert for automatic mTLS enablement
180+
if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
181+
return mtls.should_use_client_cert()
182+
else: # pragma: NO COVER
183+
# if unsupported, fallback to reading from env var
184+
use_client_cert_str = os.getenv(
185+
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
186+
).lower()
187+
if use_client_cert_str not in ("true", "false"):
188+
raise ValueError(
189+
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
190+
" either `true` or `false`"
191+
)
192+
return use_client_cert_str == "true"
193+
166194
@classmethod
167195
def from_service_account_info(cls, info: dict, *args, **kwargs):
168196
"""Creates an instance of this client using the provided credentials
@@ -510,20 +538,16 @@ def get_mtls_endpoint_and_cert_source(
510538
)
511539
if client_options is None:
512540
client_options = client_options_lib.ClientOptions()
513-
use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
541+
use_client_cert = AgentsClient._use_client_cert_effective()
514542
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
515-
if use_client_cert not in ("true", "false"):
516-
raise ValueError(
517-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
518-
)
519543
if use_mtls_endpoint not in ("auto", "never", "always"):
520544
raise MutualTLSChannelError(
521545
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
522546
)
523547

524548
# Figure out the client cert source to use.
525549
client_cert_source = None
526-
if use_client_cert == "true":
550+
if use_client_cert:
527551
if client_options.client_cert_source:
528552
client_cert_source = client_options.client_cert_source
529553
elif mtls.has_default_client_cert_source():
@@ -555,20 +579,14 @@ def _read_environment_variables():
555579
google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
556580
is not any of ["auto", "never", "always"].
557581
"""
558-
use_client_cert = os.getenv(
559-
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
560-
).lower()
582+
use_client_cert = AgentsClient._use_client_cert_effective()
561583
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
562584
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
563-
if use_client_cert not in ("true", "false"):
564-
raise ValueError(
565-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
566-
)
567585
if use_mtls_endpoint not in ("auto", "never", "always"):
568586
raise MutualTLSChannelError(
569587
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
570588
)
571-
return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
589+
return use_client_cert, use_mtls_endpoint, universe_domain_env
572590

573591
@staticmethod
574592
def _get_client_cert_source(provided_cert_source, use_cert_flag):

packages/google-cloud-dialogflow-cx/google/cloud/dialogflowcx_v3/services/changelogs/client.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,34 @@ def _get_default_mtls_endpoint(api_endpoint):
153153
_DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.{UNIVERSE_DOMAIN}"
154154
_DEFAULT_UNIVERSE = "googleapis.com"
155155

156+
@staticmethod
157+
def _use_client_cert_effective():
158+
"""Returns whether client certificate should be used for mTLS if the
159+
google-auth version supports should_use_client_cert automatic mTLS enablement.
160+
161+
Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
162+
163+
Returns:
164+
bool: whether client certificate should be used for mTLS
165+
Raises:
166+
ValueError: (If using a version of google-auth without should_use_client_cert and
167+
GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
168+
"""
169+
# check if google-auth version supports should_use_client_cert for automatic mTLS enablement
170+
if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
171+
return mtls.should_use_client_cert()
172+
else: # pragma: NO COVER
173+
# if unsupported, fallback to reading from env var
174+
use_client_cert_str = os.getenv(
175+
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
176+
).lower()
177+
if use_client_cert_str not in ("true", "false"):
178+
raise ValueError(
179+
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
180+
" either `true` or `false`"
181+
)
182+
return use_client_cert_str == "true"
183+
156184
@classmethod
157185
def from_service_account_info(cls, info: dict, *args, **kwargs):
158186
"""Creates an instance of this client using the provided credentials
@@ -342,20 +370,16 @@ def get_mtls_endpoint_and_cert_source(
342370
)
343371
if client_options is None:
344372
client_options = client_options_lib.ClientOptions()
345-
use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
373+
use_client_cert = ChangelogsClient._use_client_cert_effective()
346374
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
347-
if use_client_cert not in ("true", "false"):
348-
raise ValueError(
349-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
350-
)
351375
if use_mtls_endpoint not in ("auto", "never", "always"):
352376
raise MutualTLSChannelError(
353377
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
354378
)
355379

356380
# Figure out the client cert source to use.
357381
client_cert_source = None
358-
if use_client_cert == "true":
382+
if use_client_cert:
359383
if client_options.client_cert_source:
360384
client_cert_source = client_options.client_cert_source
361385
elif mtls.has_default_client_cert_source():
@@ -387,20 +411,14 @@ def _read_environment_variables():
387411
google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
388412
is not any of ["auto", "never", "always"].
389413
"""
390-
use_client_cert = os.getenv(
391-
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
392-
).lower()
414+
use_client_cert = ChangelogsClient._use_client_cert_effective()
393415
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
394416
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
395-
if use_client_cert not in ("true", "false"):
396-
raise ValueError(
397-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
398-
)
399417
if use_mtls_endpoint not in ("auto", "never", "always"):
400418
raise MutualTLSChannelError(
401419
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
402420
)
403-
return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
421+
return use_client_cert, use_mtls_endpoint, universe_domain_env
404422

405423
@staticmethod
406424
def _get_client_cert_source(provided_cert_source, use_cert_flag):

0 commit comments

Comments
 (0)