diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 9ee60f7e..a9fcd07c 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
- digest: sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b
+ digest: sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803
diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml
index af599353..3e98ae70 100644
--- a/.github/sync-repo-settings.yaml
+++ b/.github/sync-repo-settings.yaml
@@ -1,9 +1,11 @@
-# https://github.com/googleapis/repo-automation-bots/tree/master/packages/sync-repo-settings
-# Rules for master branch protection
+# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings
+# Rules for main branch protection
branchProtectionRules:
# Identifies the protection rule pattern. Name of the branch to be protected.
-# Defaults to `master`
-- pattern: master
+# Defaults to `main`
+- pattern: main
+ requiresCodeOwnerReviews: true
+ requiresStrictStatusChecks: true
requiredStatusCheckContexts:
- 'Kokoro'
- 'cla/google'
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index e6b479bf..06595a97 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -41,7 +41,7 @@ python3 -m pip install --upgrade --quiet nox
python3 -m nox --version
# If this is a continuous build, send the test log to the FlakyBot.
-# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
+# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh
index 311a8d54..8a324c9c 100755
--- a/.kokoro/test-samples-impl.sh
+++ b/.kokoro/test-samples-impl.sh
@@ -80,7 +80,7 @@ for file in samples/**/requirements.txt; do
EXIT=$?
# If this is a periodic build, send the test log to the FlakyBot.
- # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
+ # See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4320a42..2ba5618d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,26 @@
# Changelog
+## [1.3.0](https://www.github.com/googleapis/python-dialogflow-cx/compare/v1.2.0...v1.3.0) (2021-08-27)
+
+
+### Features
+
+* **v3:** added support for DLP templates ([#144](https://www.github.com/googleapis/python-dialogflow-cx/issues/144)) ([c74e3ac](https://www.github.com/googleapis/python-dialogflow-cx/commit/c74e3acb609363cdf941586e98ed2c8c5804980b))
+* **v3beta1:** added support for DLP templates ([#143](https://www.github.com/googleapis/python-dialogflow-cx/issues/143)) ([7efb89c](https://www.github.com/googleapis/python-dialogflow-cx/commit/7efb89cc6311e1df9d03740ba6d078af3f79559e))
+* **v3beta1:** expose `Locations` service to get/list avaliable locations of Dialogflow products ([7efb89c](https://www.github.com/googleapis/python-dialogflow-cx/commit/7efb89cc6311e1df9d03740ba6d078af3f79559e))
+* **v3:** expose `Locations` service to get/list avaliable locations of Dialogflow products ([c74e3ac](https://www.github.com/googleapis/python-dialogflow-cx/commit/c74e3acb609363cdf941586e98ed2c8c5804980b))
+
+
+### Documentation
+
+* clarified LRO types ([#156](https://www.github.com/googleapis/python-dialogflow-cx/issues/156)) ([a50e8dc](https://www.github.com/googleapis/python-dialogflow-cx/commit/a50e8dca8952cea19be2587ee68c600a41a92eeb))
+* fixed incorrect update mask descriptions ([a50e8dc](https://www.github.com/googleapis/python-dialogflow-cx/commit/a50e8dca8952cea19be2587ee68c600a41a92eeb))
+* **samples:** add agent creation code snippet ([#146](https://www.github.com/googleapis/python-dialogflow-cx/issues/146)) ([272fc98](https://www.github.com/googleapis/python-dialogflow-cx/commit/272fc9879e536f7a9ea31d8c10169cf644170769))
+* **samples:** add region tags ([#150](https://www.github.com/googleapis/python-dialogflow-cx/issues/150)) ([54ea84d](https://www.github.com/googleapis/python-dialogflow-cx/commit/54ea84d58064a7c8d0a71f020a0c8cf36ac157bd))
+* **samples:** add region tags ([#151](https://www.github.com/googleapis/python-dialogflow-cx/issues/151)) ([788b67a](https://www.github.com/googleapis/python-dialogflow-cx/commit/788b67a8c966788a70a5d683a5e79e3a289c7ba3))
+* **samples:** add update intent sample ([#142](https://www.github.com/googleapis/python-dialogflow-cx/issues/142)) ([3e80235](https://www.github.com/googleapis/python-dialogflow-cx/commit/3e80235277a0df12644d743f6853ba45263a1239))
+* **v3beta1:** reorder some fields ([7efb89c](https://www.github.com/googleapis/python-dialogflow-cx/commit/7efb89cc6311e1df9d03740ba6d078af3f79559e))
+
## [1.2.0](https://www.github.com/googleapis/python-dialogflow-cx/compare/v1.1.1...v1.2.0) (2021-08-02)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 81ed89f5..9f7ee184 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -50,9 +50,9 @@ You'll have to create a development environment using a Git checkout:
# Configure remotes such that you can pull changes from the googleapis/python-dialogflow-cx
# repository into your local repository.
$ git remote add upstream git@github.com:googleapis/python-dialogflow-cx.git
- # fetch and merge changes from upstream into master
+ # fetch and merge changes from upstream into main
$ git fetch upstream
- $ git merge upstream/master
+ $ git merge upstream/main
Now your local repo is set up such that you will push changes to your GitHub
repo, from which you can submit a pull request.
@@ -110,12 +110,12 @@ Coding Style
variables::
export GOOGLE_CLOUD_TESTING_REMOTE="upstream"
- export GOOGLE_CLOUD_TESTING_BRANCH="master"
+ export GOOGLE_CLOUD_TESTING_BRANCH="main"
By doing this, you are specifying the location of the most up-to-date
version of ``python-dialogflow-cx``. The the suggested remote name ``upstream``
should point to the official ``googleapis`` checkout and the
- the branch should be the main branch on that remote (``master``).
+ the branch should be the main branch on that remote (``main``).
- This repository contains configuration for the
`pre-commit `__ tool, which automates checking
@@ -209,7 +209,7 @@ The `description on PyPI`_ for the project comes directly from the
``README``. Due to the reStructuredText (``rst``) parser used by
PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst``
instead of
-``https://github.com/googleapis/python-dialogflow-cx/blob/master/CONTRIBUTING.rst``)
+``https://github.com/googleapis/python-dialogflow-cx/blob/main/CONTRIBUTING.rst``)
may cause problems creating links or rendering the description.
.. _description on PyPI: https://pypi.org/project/google-cloud-dialogflow-cx
@@ -234,7 +234,7 @@ We support:
Supported versions can be found in our ``noxfile.py`` `config`_.
-.. _config: https://github.com/googleapis/python-dialogflow-cx/blob/master/noxfile.py
+.. _config: https://github.com/googleapis/python-dialogflow-cx/blob/main/noxfile.py
We also explicitly decided to support Python 3 beginning with version 3.6.
diff --git a/docs/conf.py b/docs/conf.py
index 50eedc3b..363286f1 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -76,8 +76,8 @@
# The encoding of source files.
# source_encoding = 'utf-8-sig'
-# The master toctree document.
-master_doc = "index"
+# The main toctree document.
+root_doc = "index"
# General information about the project.
project = "google-cloud-dialogflow-cx"
@@ -110,6 +110,7 @@
# directories to ignore when looking for source files.
exclude_patterns = [
"_build",
+ "**/.nox/**/*",
"samples/AUTHORING_GUIDE.md",
"samples/CONTRIBUTING.md",
"samples/snippets/README.rst",
@@ -279,7 +280,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
- master_doc,
+ root_doc,
"google-cloud-dialogflow-cx.tex",
"google-cloud-dialogflow-cx Documentation",
author,
@@ -314,7 +315,7 @@
# (source start file, name, description, authors, manual section).
man_pages = [
(
- master_doc,
+ root_doc,
"google-cloud-dialogflow-cx",
"google-cloud-dialogflow-cx Documentation",
[author],
@@ -333,7 +334,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(
- master_doc,
+ root_doc,
"google-cloud-dialogflow-cx",
"google-cloud-dialogflow-cx Documentation",
author,
diff --git a/google/cloud/dialogflowcx_v3/services/agents/async_client.py b/google/cloud/dialogflowcx_v3/services/agents/async_client.py
index 8203dcd1..9e7304bd 100644
--- a/google/cloud/dialogflowcx_v3/services/agents/async_client.py
+++ b/google/cloud/dialogflowcx_v3/services/agents/async_client.py
@@ -606,7 +606,16 @@ async def export_agent(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
- r"""Exports the specified agent to a binary file.
+ r"""Exports the specified agent to a binary file. This method is a
+ `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``: An empty `Struct
+ message `__
+ - ``response``:
+ [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.ExportAgentRequest`):
diff --git a/google/cloud/dialogflowcx_v3/services/agents/client.py b/google/cloud/dialogflowcx_v3/services/agents/client.py
index b4b7d424..26626f2e 100644
--- a/google/cloud/dialogflowcx_v3/services/agents/client.py
+++ b/google/cloud/dialogflowcx_v3/services/agents/client.py
@@ -871,7 +871,16 @@ def export_agent(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
- r"""Exports the specified agent to a binary file.
+ r"""Exports the specified agent to a binary file. This method is a
+ `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``: An empty `Struct
+ message `__
+ - ``response``:
+ [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Args:
request (google.cloud.dialogflowcx_v3.types.ExportAgentRequest):
diff --git a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py
index 242f5237..36408525 100644
--- a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py
+++ b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py
@@ -385,7 +385,16 @@ def export_agent(
) -> Callable[[agent.ExportAgentRequest], operations_pb2.Operation]:
r"""Return a callable for the export agent method over gRPC.
- Exports the specified agent to a binary file.
+ Exports the specified agent to a binary file. This method is a
+ `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``: An empty `Struct
+ message `__
+ - ``response``:
+ [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Returns:
Callable[[~.ExportAgentRequest],
diff --git a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc_asyncio.py b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc_asyncio.py
index 540efbec..491694cf 100644
--- a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc_asyncio.py
+++ b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc_asyncio.py
@@ -392,7 +392,16 @@ def export_agent(
) -> Callable[[agent.ExportAgentRequest], Awaitable[operations_pb2.Operation]]:
r"""Return a callable for the export agent method over gRPC.
- Exports the specified agent to a binary file.
+ Exports the specified agent to a binary file. This method is a
+ `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``: An empty `Struct
+ message `__
+ - ``response``:
+ [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Returns:
Callable[[~.ExportAgentRequest],
diff --git a/google/cloud/dialogflowcx_v3/services/flows/async_client.py b/google/cloud/dialogflowcx_v3/services/flows/async_client.py
index e32af9c8..8aac2c2c 100644
--- a/google/cloud/dialogflowcx_v3/services/flows/async_client.py
+++ b/google/cloud/dialogflowcx_v3/services/flows/async_client.py
@@ -540,9 +540,9 @@ async def update_flow(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
- Required. The mask to control which fields get updated.
- If ``update_mask`` is not specified, an error will be
- returned.
+ The mask to control which fields get
+ updated. If the mask is not present, all
+ fields will be updated.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
diff --git a/google/cloud/dialogflowcx_v3/services/flows/client.py b/google/cloud/dialogflowcx_v3/services/flows/client.py
index 19d326b2..a01607b7 100644
--- a/google/cloud/dialogflowcx_v3/services/flows/client.py
+++ b/google/cloud/dialogflowcx_v3/services/flows/client.py
@@ -813,9 +813,9 @@ def update_flow(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
- Required. The mask to control which fields get updated.
- If ``update_mask`` is not specified, an error will be
- returned.
+ The mask to control which fields get
+ updated. If the mask is not present, all
+ fields will be updated.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py
index 0ddde9bc..b0bb2f4b 100644
--- a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py
+++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py
@@ -45,6 +45,18 @@ class SecuritySettingsServiceAsyncClient:
DEFAULT_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_MTLS_ENDPOINT
+ deidentify_template_path = staticmethod(
+ SecuritySettingsServiceClient.deidentify_template_path
+ )
+ parse_deidentify_template_path = staticmethod(
+ SecuritySettingsServiceClient.parse_deidentify_template_path
+ )
+ inspect_template_path = staticmethod(
+ SecuritySettingsServiceClient.inspect_template_path
+ )
+ parse_inspect_template_path = staticmethod(
+ SecuritySettingsServiceClient.parse_inspect_template_path
+ )
security_settings_path = staticmethod(
SecuritySettingsServiceClient.security_settings_path
)
diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py
index 5a0a4e19..0e876f3b 100644
--- a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py
+++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py
@@ -161,6 +161,46 @@ def transport(self) -> SecuritySettingsServiceTransport:
"""
return self._transport
+ @staticmethod
+ def deidentify_template_path(
+ organization: str, location: str, deidentify_template: str,
+ ) -> str:
+ """Returns a fully-qualified deidentify_template string."""
+ return "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format(
+ organization=organization,
+ location=location,
+ deidentify_template=deidentify_template,
+ )
+
+ @staticmethod
+ def parse_deidentify_template_path(path: str) -> Dict[str, str]:
+ """Parses a deidentify_template path into its component segments."""
+ m = re.match(
+ r"^organizations/(?P.+?)/locations/(?P.+?)/deidentifyTemplates/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def inspect_template_path(
+ organization: str, location: str, inspect_template: str,
+ ) -> str:
+ """Returns a fully-qualified inspect_template string."""
+ return "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format(
+ organization=organization,
+ location=location,
+ inspect_template=inspect_template,
+ )
+
+ @staticmethod
+ def parse_inspect_template_path(path: str) -> Dict[str, str]:
+ """Parses a inspect_template path into its component segments."""
+ m = re.match(
+ r"^organizations/(?P.+?)/locations/(?P.+?)/inspectTemplates/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
@staticmethod
def security_settings_path(
project: str, location: str, security_settings: str,
diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py b/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py
index aadcc2f5..2254e865 100644
--- a/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py
+++ b/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py
@@ -568,7 +568,15 @@ async def run_test_case(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
- r"""Kicks off a test case run.
+ r"""Kicks off a test case run. This method is a `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``:
+ [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
+ - ``response``:
+ [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.RunTestCaseRequest`):
diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/client.py b/google/cloud/dialogflowcx_v3/services/test_cases/client.py
index f013a810..1638c23b 100644
--- a/google/cloud/dialogflowcx_v3/services/test_cases/client.py
+++ b/google/cloud/dialogflowcx_v3/services/test_cases/client.py
@@ -899,7 +899,15 @@ def run_test_case(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
- r"""Kicks off a test case run.
+ r"""Kicks off a test case run. This method is a `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``:
+ [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
+ - ``response``:
+ [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
Args:
request (google.cloud.dialogflowcx_v3.types.RunTestCaseRequest):
diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py
index 7f7ad9b9..f33ddf4d 100644
--- a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py
+++ b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py
@@ -382,7 +382,15 @@ def run_test_case(
) -> Callable[[test_case.RunTestCaseRequest], operations_pb2.Operation]:
r"""Return a callable for the run test case method over gRPC.
- Kicks off a test case run.
+ Kicks off a test case run. This method is a `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``:
+ [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
+ - ``response``:
+ [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
Returns:
Callable[[~.RunTestCaseRequest],
diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py
index 84c36ecb..59dfdae6 100644
--- a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py
+++ b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py
@@ -393,7 +393,15 @@ def run_test_case(
) -> Callable[[test_case.RunTestCaseRequest], Awaitable[operations_pb2.Operation]]:
r"""Return a callable for the run test case method over gRPC.
- Kicks off a test case run.
+ Kicks off a test case run. This method is a `long-running
+ operation `__.
+ The returned ``Operation`` type has the following
+ method-specific fields:
+
+ - ``metadata``:
+ [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
+ - ``response``:
+ [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
Returns:
Callable[[~.RunTestCaseRequest],
diff --git a/google/cloud/dialogflowcx_v3/types/flow.py b/google/cloud/dialogflowcx_v3/types/flow.py
index f26652e7..7b05edb3 100644
--- a/google/cloud/dialogflowcx_v3/types/flow.py
+++ b/google/cloud/dialogflowcx_v3/types/flow.py
@@ -322,8 +322,9 @@ class UpdateFlowRequest(proto.Message):
flow (google.cloud.dialogflowcx_v3.types.Flow):
Required. The flow to update.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
- Required. The mask to control which fields get updated. If
- ``update_mask`` is not specified, an error will be returned.
+ The mask to control which fields get updated.
+ If the mask is not present, all fields will be
+ updated.
language_code (str):
The language of the following fields in ``flow``:
diff --git a/google/cloud/dialogflowcx_v3/types/security_settings.py b/google/cloud/dialogflowcx_v3/types/security_settings.py
index 7b0e1bff..63c4587d 100644
--- a/google/cloud/dialogflowcx_v3/types/security_settings.py
+++ b/google/cloud/dialogflowcx_v3/types/security_settings.py
@@ -165,10 +165,27 @@ class SecuritySettings(proto.Message):
If empty, we use the default DLP inspect config.
The template name will have one of the following formats:
- ``projects//inspectTemplates/`` OR
``projects//locations//inspectTemplates/``
OR
- ``organizations//inspectTemplates/``
+ ``organizations//locations//inspectTemplates/``
+
+ Note: ``inspect_template`` must be located in the same
+ region as the ``SecuritySettings``.
+ deidentify_template (str):
+ `DLP `__ deidentify
+ template name. Use this template to define de-identification
+ configuration for the content.
+
+ If empty, Dialogflow replaces sensitive info with
+ ``[redacted]`` text.
+
+ The template name will have one of the following formats:
+ ``projects//locations//deidentifyTemplates/``
+ OR
+ ``organizations//locations//deidentifyTemplates/``
+
+ Note: ``deidentify_template`` must be located in the same
+ region as the ``SecuritySettings``.
retention_window_days (int):
Retains data in interaction logging for the
specified number of days. This does not apply to
@@ -186,8 +203,8 @@ class SecuritySettings(proto.Message):
List of types of data to remove when
retention settings triggers purge.
insights_export_settings (google.cloud.dialogflowcx_v3.types.SecuritySettings.InsightsExportSettings):
- Optional. Controls conversation exporting settings to
- Insights after conversation is completed.
+ Controls conversation exporting settings to Insights after
+ conversation is completed.
If
[retention_strategy][google.cloud.dialogflow.cx.v3.SecuritySettings.retention_strategy]
@@ -230,6 +247,7 @@ class InsightsExportSettings(proto.Message):
redaction_strategy = proto.Field(proto.ENUM, number=3, enum=RedactionStrategy,)
redaction_scope = proto.Field(proto.ENUM, number=4, enum=RedactionScope,)
inspect_template = proto.Field(proto.STRING, number=9,)
+ deidentify_template = proto.Field(proto.STRING, number=17,)
retention_window_days = proto.Field(proto.INT32, number=6, oneof="data_retention",)
purge_data_types = proto.RepeatedField(proto.ENUM, number=8, enum=PurgeDataType,)
insights_export_settings = proto.Field(
diff --git a/google/cloud/dialogflowcx_v3/types/test_case.py b/google/cloud/dialogflowcx_v3/types/test_case.py
index 9c77ccab..fcbbcff8 100644
--- a/google/cloud/dialogflowcx_v3/types/test_case.py
+++ b/google/cloud/dialogflowcx_v3/types/test_case.py
@@ -223,7 +223,8 @@ class VirtualAgentOutput(proto.Message):
diagnostic_info (google.protobuf.struct_pb2.Struct):
Required. Input only. The diagnostic
[info][Session.DetectIntentResponse.QueryResult.diagnostic_info]
- output for the turn.
+ output for the turn. Required to calculate the testing
+ coverage.
triggered_intent (google.cloud.dialogflowcx_v3.types.Intent):
The [Intent][google.cloud.dialogflow.cx.v3.Intent] that
triggered the response. Only name and displayName will be
@@ -664,7 +665,7 @@ class RunTestCaseResponse(proto.Message):
class RunTestCaseMetadata(proto.Message):
r"""Metadata returned for the
[TestCases.RunTestCase][google.cloud.dialogflow.cx.v3.TestCases.RunTestCase]
- long running operation.
+ long running operation. This message currently has no fields.
"""
diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py
index e5537908..eaf1aec3 100644
--- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py
+++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py
@@ -45,6 +45,18 @@ class SecuritySettingsServiceAsyncClient:
DEFAULT_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_MTLS_ENDPOINT
+ deidentify_template_path = staticmethod(
+ SecuritySettingsServiceClient.deidentify_template_path
+ )
+ parse_deidentify_template_path = staticmethod(
+ SecuritySettingsServiceClient.parse_deidentify_template_path
+ )
+ inspect_template_path = staticmethod(
+ SecuritySettingsServiceClient.inspect_template_path
+ )
+ parse_inspect_template_path = staticmethod(
+ SecuritySettingsServiceClient.parse_inspect_template_path
+ )
security_settings_path = staticmethod(
SecuritySettingsServiceClient.security_settings_path
)
diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py
index db726da1..55692ece 100644
--- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py
+++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py
@@ -161,6 +161,46 @@ def transport(self) -> SecuritySettingsServiceTransport:
"""
return self._transport
+ @staticmethod
+ def deidentify_template_path(
+ organization: str, location: str, deidentify_template: str,
+ ) -> str:
+ """Returns a fully-qualified deidentify_template string."""
+ return "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format(
+ organization=organization,
+ location=location,
+ deidentify_template=deidentify_template,
+ )
+
+ @staticmethod
+ def parse_deidentify_template_path(path: str) -> Dict[str, str]:
+ """Parses a deidentify_template path into its component segments."""
+ m = re.match(
+ r"^organizations/(?P.+?)/locations/(?P.+?)/deidentifyTemplates/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def inspect_template_path(
+ organization: str, location: str, inspect_template: str,
+ ) -> str:
+ """Returns a fully-qualified inspect_template string."""
+ return "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format(
+ organization=organization,
+ location=location,
+ inspect_template=inspect_template,
+ )
+
+ @staticmethod
+ def parse_inspect_template_path(path: str) -> Dict[str, str]:
+ """Parses a inspect_template path into its component segments."""
+ m = re.match(
+ r"^organizations/(?P.+?)/locations/(?P.+?)/inspectTemplates/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
@staticmethod
def security_settings_path(
project: str, location: str, security_settings: str,
diff --git a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py
index 0a2bdebf..4cefe4be 100644
--- a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py
+++ b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py
@@ -165,10 +165,27 @@ class SecuritySettings(proto.Message):
If empty, we use the default DLP inspect config.
The template name will have one of the following formats:
- ``projects//inspectTemplates/`` OR
``projects//locations//inspectTemplates/``
OR
- ``organizations//inspectTemplates/``
+ ``organizations//locations//inspectTemplates/``
+
+ Note: ``inspect_template`` must be located in the same
+ region as the ``SecuritySettings``.
+ deidentify_template (str):
+ `DLP `__ deidentify
+ template name. Use this template to define de-identification
+ configuration for the content.
+
+ If empty, Dialogflow replaces sensitive info with
+ ``[redacted]`` text.
+
+ The template name will have one of the following formats:
+ ``projects//locations//deidentifyTemplates/``
+ OR
+ ``organizations//locations//deidentifyTemplates/``
+
+ Note: ``deidentify_template`` must be located in the same
+ region as the ``SecuritySettings``.
retention_window_days (int):
Retains data in interaction logging for the
specified number of days. This does not apply to
@@ -186,8 +203,8 @@ class SecuritySettings(proto.Message):
List of types of data to remove when
retention settings triggers purge.
insights_export_settings (google.cloud.dialogflowcx_v3beta1.types.SecuritySettings.InsightsExportSettings):
- Optional. Controls conversation exporting settings to
- Insights after conversation is completed.
+ Controls conversation exporting settings to Insights after
+ conversation is completed.
If
[retention_strategy][google.cloud.dialogflow.cx.v3beta1.SecuritySettings.retention_strategy]
@@ -230,6 +247,7 @@ class InsightsExportSettings(proto.Message):
redaction_strategy = proto.Field(proto.ENUM, number=3, enum=RedactionStrategy,)
redaction_scope = proto.Field(proto.ENUM, number=4, enum=RedactionScope,)
inspect_template = proto.Field(proto.STRING, number=9,)
+ deidentify_template = proto.Field(proto.STRING, number=17,)
retention_window_days = proto.Field(proto.INT32, number=6, oneof="data_retention",)
purge_data_types = proto.RepeatedField(proto.ENUM, number=8, enum=PurgeDataType,)
insights_export_settings = proto.Field(
diff --git a/noxfile.py b/noxfile.py
index fbc00662..3470bee8 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -84,9 +84,15 @@ def default(session):
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
- session.install("asyncmock", "pytest-asyncio", "-c", constraints_path)
-
- session.install("mock", "pytest", "pytest-cov", "-c", constraints_path)
+ session.install(
+ "mock",
+ "asyncmock",
+ "pytest",
+ "pytest-cov",
+ "pytest-asyncio",
+ "-c",
+ constraints_path,
+ )
session.install("-e", ".", "-c", constraints_path)
diff --git a/owlbot.py b/owlbot.py
index 9a70c994..92dfe77b 100644
--- a/owlbot.py
+++ b/owlbot.py
@@ -41,6 +41,7 @@
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(cov_level=99, microgenerator=True)
+python.py_samples(skip_readmes=True)
s.move(
templated_files, excludes=[".coveragerc"]
) # the microgenerator has a good coveragerc file
@@ -53,3 +54,44 @@
)
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
+
+# ----------------------------------------------------------------------------
+# Main Branch migration
+# ----------------------------------------------------------------------------
+
+s.replace(
+ "*.rst",
+ "master",
+ "main"
+)
+
+s.replace(
+ "CONTRIBUTING.rst",
+ "kubernetes/community/blob/main",
+ "kubernetes/community/blob/master"
+)
+
+s.replace(
+ "docs/conf.py",
+ "master",
+ "main"
+)
+
+s.replace(
+ "docs/conf.py",
+ "main_doc",
+ "root_doc"
+)
+
+s.replace(
+ ".kokoro/*",
+ "master",
+ "main"
+)
+
+s.replace(
+ "README.rst",
+ "google-cloud-python/blob/main/README.rst",
+ "google-cloud-python/blob/master/README.rst"
+)
+
diff --git a/samples/AUTHORING_GUIDE.md b/samples/AUTHORING_GUIDE.md
index 55c97b32..ab870f39 100644
--- a/samples/AUTHORING_GUIDE.md
+++ b/samples/AUTHORING_GUIDE.md
@@ -1 +1 @@
-See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md
\ No newline at end of file
+See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md
diff --git a/samples/CONTRIBUTING.md b/samples/CONTRIBUTING.md
index 34c882b6..fc4b8941 100644
--- a/samples/CONTRIBUTING.md
+++ b/samples/CONTRIBUTING.md
@@ -1 +1 @@
-See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md
\ No newline at end of file
+See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md
diff --git a/samples/snippets/create_agent.py b/samples/snippets/create_agent.py
new file mode 100644
index 00000000..8b116812
--- /dev/null
+++ b/samples/snippets/create_agent.py
@@ -0,0 +1,38 @@
+# Copyright 2021 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+"""DialogFlow API Create Agent Sample"""
+
+## [START dialogflow_cx_create_agent_sample]
+from google.cloud.dialogflowcx_v3.services.agents.client import AgentsClient
+from google.cloud.dialogflowcx_v3.types.agent import Agent
+
+
+def create_agent(project_id, display_name):
+
+ parent = "projects/" + project_id + "/locations/global"
+
+ agents_client = AgentsClient()
+
+ agent = Agent(
+ display_name=display_name,
+ default_language_code="en",
+ time_zone="America/Los_Angeles",
+ )
+
+ response = agents_client.create_agent(request={"agent": agent, "parent": parent})
+
+ return response
+## [END dialogflow_cx_create_agent_sample]
diff --git a/samples/snippets/create_agent_test.py b/samples/snippets/create_agent_test.py
new file mode 100644
index 00000000..320a25cb
--- /dev/null
+++ b/samples/snippets/create_agent_test.py
@@ -0,0 +1,42 @@
+# Copyright 2020, Google LLC
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Test for create_agent"""
+
+from datetime import date
+import os
+
+from google.cloud.dialogflowcx_v3.services.agents.client import AgentsClient
+from google.cloud.dialogflowcx_v3.types.agent import DeleteAgentRequest
+
+import pytest
+
+from create_agent import create_agent
+
+PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
+pytest.AGENT_PATH = ""
+
+
+def delete_agent(name):
+ agents_client = AgentsClient()
+ request = DeleteAgentRequest(name=name)
+ agents_client.delete_agent(request=request)
+
+
+def test_create_agent():
+ today = date.today()
+ agentName = "tempAgent." + today.strftime("%d.%m.%Y")
+ response = create_agent(PROJECT_ID, agentName)
+ delete_agent(response.name)
+
+ assert response.display_name == agentName
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
index ba55d7ce..e73436a1 100644
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -17,6 +17,7 @@
import os
from pathlib import Path
import sys
+from typing import Callable, Dict, List, Optional
import nox
@@ -27,8 +28,9 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING
-# Copy `noxfile_config.py` to your directory and modify it instead.
+BLACK_VERSION = "black==19.10b0"
+# Copy `noxfile_config.py` to your directory and modify it instead.
# `TEST_CONFIG` dict is a configuration hook that allows users to
# modify the test configurations. The values here should be in sync
@@ -37,7 +39,11 @@
TEST_CONFIG = {
# You can opt out from the test for specific Python versions.
- 'ignored_versions': ["2.7"],
+ 'ignored_versions': [],
+
+ # Old samples are opted out of enforcing Python type hints
+ # All new samples should feature them
+ 'enforce_type_hints': False,
# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
@@ -45,7 +51,10 @@
# to use your own Cloud project.
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
-
+ # If you need to use a specific version of pip,
+ # change pip_version_override to the string representation
+ # of the version number, for example, "20.2.4"
+ "pip_version_override": None,
# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
'envs': {},
@@ -64,7 +73,7 @@
TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
-def get_pytest_env_vars():
+def get_pytest_env_vars() -> Dict[str, str]:
"""Returns a dict for pytest invocation."""
ret = {}
@@ -79,21 +88,21 @@ def get_pytest_env_vars():
# DO NOT EDIT - automatically generated.
-# All versions used to tested samples.
-ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
+# All versions used to test samples.
+ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
-INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
+INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
#
# Style Checks
#
-def _determine_local_import_names(start_dir):
+def _determine_local_import_names(start_dir: str) -> List[str]:
"""Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
@@ -131,8 +140,11 @@ def _determine_local_import_names(start_dir):
@nox.session
-def lint(session):
- session.install("flake8", "flake8-import-order")
+def lint(session: nox.sessions.Session) -> None:
+ if not TEST_CONFIG['enforce_type_hints']:
+ session.install("flake8", "flake8-import-order")
+ else:
+ session.install("flake8", "flake8-import-order", "flake8-annotations")
local_names = _determine_local_import_names(".")
args = FLAKE8_COMMON_ARGS + [
@@ -141,7 +153,17 @@ def lint(session):
"."
]
session.run("flake8", *args)
+#
+# Black
+#
+
+@nox.session
+def blacken(session: nox.sessions.Session) -> None:
+ session.install(BLACK_VERSION)
+ python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+ session.run("black", *python_files)
#
# Sample Tests
@@ -151,13 +173,22 @@ def lint(session):
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
-def _session_tests(session, post_install=None):
+def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+ if TEST_CONFIG["pip_version_override"]:
+ pip_version = TEST_CONFIG["pip_version_override"]
+ session.install(f"pip=={pip_version}")
"""Runs py.test for a particular project."""
if os.path.exists("requirements.txt"):
- session.install("-r", "requirements.txt")
+ if os.path.exists("constraints.txt"):
+ session.install("-r", "requirements.txt", "-c", "constraints.txt")
+ else:
+ session.install("-r", "requirements.txt")
if os.path.exists("requirements-test.txt"):
- session.install("-r", "requirements-test.txt")
+ if os.path.exists("constraints-test.txt"):
+ session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
+ else:
+ session.install("-r", "requirements-test.txt")
if INSTALL_LIBRARY_FROM_SOURCE:
session.install("-e", _get_repo_root())
@@ -177,7 +208,7 @@ def _session_tests(session, post_install=None):
@nox.session(python=ALL_VERSIONS)
-def py(session):
+def py(session: nox.sessions.Session) -> None:
"""Runs py.test for a sample using the specified version of Python."""
if session.python in TESTED_VERSIONS:
_session_tests(session)
@@ -192,7 +223,7 @@ def py(session):
#
-def _get_repo_root():
+def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
@@ -201,6 +232,11 @@ def _get_repo_root():
break
if Path(p / ".git").exists():
return str(p)
+ # .git is not available in repos cloned via Cloud Build
+ # setup.py is always in the library's root, so use that instead
+ # https://github.com/googleapis/synthtool/issues/792
+ if Path(p / "setup.py").exists():
+ return str(p)
p = p.parent
raise Exception("Unable to detect repository root.")
@@ -210,7 +246,7 @@ def _get_repo_root():
@nox.session
@nox.parametrize("path", GENERATED_READMES)
-def readmegen(session, path):
+def readmegen(session: nox.sessions.Session, path: str) -> None:
"""(Re-)generates the readme for a sample."""
session.install("jinja2", "pyyaml")
dir_ = os.path.dirname(path)
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index b344a336..40df41be 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1 +1 @@
-google-cloud-dialogflow-cx==1.1.1
+google-cloud-dialogflow-cx==1.2.0
diff --git a/samples/snippets/update_intent.py b/samples/snippets/update_intent.py
new file mode 100644
index 00000000..9ba552a4
--- /dev/null
+++ b/samples/snippets/update_intent.py
@@ -0,0 +1,31 @@
+# Copyright 2021, Google LLC
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START dialogflow_cx_update_intent]
+from google.cloud.dialogflowcx_v3.services.intents import IntentsClient
+from google.protobuf import field_mask_pb2
+
+
+def update_intent(project_id, agent_id, intent_id, location, displayName):
+
+ intents_client = IntentsClient()
+
+ intent_name = intents_client.intent_path(project_id, location, agent_id, intent_id)
+
+ intent = intents_client.get_intent(request={"name": intent_name})
+
+ intent.display_name = displayName
+ update_mask = field_mask_pb2.FieldMask(paths=["display_name"])
+ response = intents_client.update_intent(intent=intent, update_mask=update_mask)
+ return response
+# [END dialogflow_cx_update_intent]
diff --git a/samples/snippets/update_intent_test.py b/samples/snippets/update_intent_test.py
new file mode 100644
index 00000000..58fafa60
--- /dev/null
+++ b/samples/snippets/update_intent_test.py
@@ -0,0 +1,82 @@
+# Copyright 2021, Google LLC
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import uuid
+
+from google.cloud.dialogflowcx_v3.services.agents.client import AgentsClient
+from google.cloud.dialogflowcx_v3.services.intents.client import IntentsClient
+from google.cloud.dialogflowcx_v3.types.agent import Agent, DeleteAgentRequest
+from google.cloud.dialogflowcx_v3.types.intent import CreateIntentRequest, Intent
+
+import pytest
+
+from update_intent import update_intent
+
+PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
+pytest.INTENT_ID = None
+pytest.AGENT_ID = None
+pytest.PARENT = None
+
+
+def create_agent(project_id, display_name):
+ parent = "projects/" + project_id + "/locations/global"
+
+ agents_client = AgentsClient()
+
+ agent = Agent(
+ display_name=display_name,
+ default_language_code="en",
+ time_zone="America/Los_Angeles",
+ )
+
+ response = agents_client.create_agent(request={"agent": agent, "parent": parent})
+
+ return response
+
+
+def delete_agent(name):
+ agents_client = AgentsClient()
+ agent = DeleteAgentRequest(name=name)
+ agents_client.delete_agent(request=agent)
+
+
+@pytest.fixture(scope="function", autouse=True)
+def setup_teardown():
+ agentName = "temp_agent_" + str(uuid.uuid4())
+ pytest.PARENT = create_agent(PROJECT_ID, agentName).name
+ pytest.AGENT_ID = pytest.PARENT.split("/")[5]
+ print("Created Agent in setUp")
+ intentClient = IntentsClient()
+ intent = Intent()
+
+ intent.display_name = "fake_intent"
+
+ req = CreateIntentRequest()
+ req.parent = pytest.PARENT
+ req.intent = intent
+
+ pytest.INTENT_ID = intentClient.create_intent(request=req).name.split("/")[7]
+
+ yield
+
+ delete_agent(pytest.PARENT)
+
+
+def test_fieldmaskTest():
+ fake_intent = f"fake_intent_{uuid.uuid4()}"
+ actualResponse = update_intent(
+ PROJECT_ID, pytest.AGENT_ID, pytest.INTENT_ID, "global", fake_intent
+ )
+
+ assert actualResponse.display_name == fake_intent
diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst
index a0406dba..275d6498 100644
--- a/scripts/readme-gen/templates/install_deps.tmpl.rst
+++ b/scripts/readme-gen/templates/install_deps.tmpl.rst
@@ -12,7 +12,7 @@ Install Dependencies
.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup
-#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
+#. Create a virtualenv. Samples are compatible with Python 3.6+.
.. code-block:: bash
diff --git a/setup.py b/setup.py
index 6419ba80..26846713 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
import os
import setuptools # type: ignore
-version = "1.2.0"
+version = "1.3.0"
package_root = os.path.abspath(os.path.dirname(__file__))
diff --git a/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py b/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py
index a48a4ca0..f1e03794 100644
--- a/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py
+++ b/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py
@@ -548,6 +548,7 @@ def test_create_security_settings(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -573,6 +574,7 @@ def test_create_security_settings(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -624,6 +626,7 @@ async def test_create_security_settings_async(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -649,6 +652,7 @@ async def test_create_security_settings_async(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -840,6 +844,7 @@ def test_get_security_settings(
redaction_strategy=security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -865,6 +870,7 @@ def test_get_security_settings(
== security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -916,6 +922,7 @@ async def test_get_security_settings_async(
redaction_strategy=security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -941,6 +948,7 @@ async def test_get_security_settings_async(
== security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -1109,6 +1117,7 @@ def test_update_security_settings(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -1134,6 +1143,7 @@ def test_update_security_settings(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -1185,6 +1195,7 @@ async def test_update_security_settings_async(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -1210,6 +1221,7 @@ async def test_update_security_settings_async(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -2485,6 +2497,60 @@ def test_security_settings_service_transport_channel_mtls_with_adc(transport_cla
assert transport.grpc_channel == mock_grpc_channel
+def test_deidentify_template_path():
+ organization = "squid"
+ location = "clam"
+ deidentify_template = "whelk"
+ expected = "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format(
+ organization=organization,
+ location=location,
+ deidentify_template=deidentify_template,
+ )
+ actual = SecuritySettingsServiceClient.deidentify_template_path(
+ organization, location, deidentify_template
+ )
+ assert expected == actual
+
+
+def test_parse_deidentify_template_path():
+ expected = {
+ "organization": "octopus",
+ "location": "oyster",
+ "deidentify_template": "nudibranch",
+ }
+ path = SecuritySettingsServiceClient.deidentify_template_path(**expected)
+
+ # Check that the path construction is reversible.
+ actual = SecuritySettingsServiceClient.parse_deidentify_template_path(path)
+ assert expected == actual
+
+
+def test_inspect_template_path():
+ organization = "cuttlefish"
+ location = "mussel"
+ inspect_template = "winkle"
+ expected = "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format(
+ organization=organization, location=location, inspect_template=inspect_template,
+ )
+ actual = SecuritySettingsServiceClient.inspect_template_path(
+ organization, location, inspect_template
+ )
+ assert expected == actual
+
+
+def test_parse_inspect_template_path():
+ expected = {
+ "organization": "nautilus",
+ "location": "scallop",
+ "inspect_template": "abalone",
+ }
+ path = SecuritySettingsServiceClient.inspect_template_path(**expected)
+
+ # Check that the path construction is reversible.
+ actual = SecuritySettingsServiceClient.parse_inspect_template_path(path)
+ assert expected == actual
+
+
def test_security_settings_path():
project = "squid"
location = "clam"
diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py
index 5ec95807..e2db6afc 100644
--- a/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py
+++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py
@@ -550,6 +550,7 @@ def test_create_security_settings(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -575,6 +576,7 @@ def test_create_security_settings(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -626,6 +628,7 @@ async def test_create_security_settings_async(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -651,6 +654,7 @@ async def test_create_security_settings_async(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -842,6 +846,7 @@ def test_get_security_settings(
redaction_strategy=security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -867,6 +872,7 @@ def test_get_security_settings(
== security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -918,6 +924,7 @@ async def test_get_security_settings_async(
redaction_strategy=security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -943,6 +950,7 @@ async def test_get_security_settings_async(
== security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -1111,6 +1119,7 @@ def test_update_security_settings(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -1136,6 +1145,7 @@ def test_update_security_settings(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -1187,6 +1197,7 @@ async def test_update_security_settings_async(
redaction_strategy=gcdc_security_settings.SecuritySettings.RedactionStrategy.REDACT_WITH_SERVICE,
redaction_scope=gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE,
inspect_template="inspect_template_value",
+ deidentify_template="deidentify_template_value",
purge_data_types=[
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
],
@@ -1212,6 +1223,7 @@ async def test_update_security_settings_async(
== gcdc_security_settings.SecuritySettings.RedactionScope.REDACT_DISK_STORAGE
)
assert response.inspect_template == "inspect_template_value"
+ assert response.deidentify_template == "deidentify_template_value"
assert response.purge_data_types == [
gcdc_security_settings.SecuritySettings.PurgeDataType.DIALOGFLOW_HISTORY
]
@@ -2487,6 +2499,60 @@ def test_security_settings_service_transport_channel_mtls_with_adc(transport_cla
assert transport.grpc_channel == mock_grpc_channel
+def test_deidentify_template_path():
+ organization = "squid"
+ location = "clam"
+ deidentify_template = "whelk"
+ expected = "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format(
+ organization=organization,
+ location=location,
+ deidentify_template=deidentify_template,
+ )
+ actual = SecuritySettingsServiceClient.deidentify_template_path(
+ organization, location, deidentify_template
+ )
+ assert expected == actual
+
+
+def test_parse_deidentify_template_path():
+ expected = {
+ "organization": "octopus",
+ "location": "oyster",
+ "deidentify_template": "nudibranch",
+ }
+ path = SecuritySettingsServiceClient.deidentify_template_path(**expected)
+
+ # Check that the path construction is reversible.
+ actual = SecuritySettingsServiceClient.parse_deidentify_template_path(path)
+ assert expected == actual
+
+
+def test_inspect_template_path():
+ organization = "cuttlefish"
+ location = "mussel"
+ inspect_template = "winkle"
+ expected = "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format(
+ organization=organization, location=location, inspect_template=inspect_template,
+ )
+ actual = SecuritySettingsServiceClient.inspect_template_path(
+ organization, location, inspect_template
+ )
+ assert expected == actual
+
+
+def test_parse_inspect_template_path():
+ expected = {
+ "organization": "nautilus",
+ "location": "scallop",
+ "inspect_template": "abalone",
+ }
+ path = SecuritySettingsServiceClient.inspect_template_path(**expected)
+
+ # Check that the path construction is reversible.
+ actual = SecuritySettingsServiceClient.parse_inspect_template_path(path)
+ assert expected == actual
+
+
def test_security_settings_path():
project = "squid"
location = "clam"