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/