From d146cf59db14b3c3afbef72d7a86419532ad347e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 2 Apr 2021 08:08:36 -0700 Subject: [PATCH] fix: use correct retry deadlines (#96) fix: require google-api-core>=1.22.2 --- .coveragerc | 22 +- .github/header-checker-lint.yml | 15 + .gitignore | 4 +- .kokoro/build.sh | 26 +- .kokoro/docs/docs-presubmit.cfg | 11 + .kokoro/samples/python3.6/periodic-head.cfg | 11 + .kokoro/samples/python3.7/periodic-head.cfg | 11 + .kokoro/samples/python3.8/periodic-head.cfg | 11 + .kokoro/test-samples-against-head.sh | 28 + .kokoro/test-samples-impl.sh | 102 +++ .kokoro/test-samples.sh | 96 +-- .pre-commit-config.yaml | 2 +- .trampolinerc | 1 + CONTRIBUTING.rst | 22 +- LICENSE | 7 +- MANIFEST.in | 4 +- UPGRADING.md | 4 +- docs/_static/custom.css | 7 +- docs/dlp_v2/dlp_service.rst | 11 + docs/dlp_v2/services.rst | 6 +- docs/dlp_v2/types.rst | 1 + .../services/dlp_service/async_client.py | 238 ++++-- .../dlp_v2/services/dlp_service/client.py | 281 +++--- .../dlp_v2/services/dlp_service/pagers.py | 91 +- .../services/dlp_service/transports/base.py | 38 +- .../services/dlp_service/transports/grpc.py | 112 ++- .../dlp_service/transports/grpc_asyncio.py | 120 ++- google/cloud/dlp_v2/types/__init__.py | 536 ++++++------ google/cloud/dlp_v2/types/dlp.py | 578 ++++++------- google/cloud/dlp_v2/types/storage.py | 92 +- noxfile.py | 66 +- renovate.json | 3 +- samples/snippets/noxfile.py | 2 +- setup.py | 6 +- synth.metadata | 105 +-- synth.py | 3 +- testing/constraints-3.6.txt | 4 +- testing/constraints-3.9.txt | 0 tests/unit/gapic/dlp_v2/__init__.py | 15 + tests/unit/gapic/dlp_v2/test_dlp_service.py | 805 ++++++++++++++++-- 40 files changed, 2195 insertions(+), 1302 deletions(-) create mode 100644 .github/header-checker-lint.yml create mode 100644 .kokoro/samples/python3.6/periodic-head.cfg create mode 100644 .kokoro/samples/python3.7/periodic-head.cfg create mode 100644 .kokoro/samples/python3.8/periodic-head.cfg create mode 100755 .kokoro/test-samples-against-head.sh create mode 100755 .kokoro/test-samples-impl.sh create mode 100644 docs/dlp_v2/dlp_service.rst create mode 100644 testing/constraints-3.9.txt diff --git a/.coveragerc b/.coveragerc index f158899b..89990673 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,27 +1,11 @@ -# -*- coding: utf-8 -*- -# -# 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 -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Generated by synthtool. DO NOT EDIT! [run] branch = True [report] fail_under = 100 show_missing = True -omit = google/cloud/dlp/__init__.py +omit = + google/cloud/dlp/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER @@ -31,4 +15,4 @@ exclude_lines = # This is added at the module level as a safeguard for if someone # generates the code and tries to run it without pip installing. This # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound \ No newline at end of file + except pkg_resources.DistributionNotFound diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml new file mode 100644 index 00000000..fc281c05 --- /dev/null +++ b/.github/header-checker-lint.yml @@ -0,0 +1,15 @@ +{"allowedCopyrightHolders": ["Google LLC"], + "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], + "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"], + "sourceFileExtensions": [ + "ts", + "js", + "java", + "sh", + "Dockerfile", + "yaml", + "py", + "html", + "txt" + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b9daa52f..b4243ced 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,10 @@ docs.metadata # Virtual environment env/ + +# Test logs coverage.xml -sponge_log.xml +*sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 2ed36f65..3ffa76f7 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -15,7 +15,11 @@ set -eo pipefail -cd github/python-dlp +if [[ -z "${PROJECT_ROOT:-}" ]]; then + PROJECT_ROOT="github/python-dlp" +fi + +cd "${PROJECT_ROOT}" # Disable buffering, so that the logs stream through. export PYTHONUNBUFFERED=1 @@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") # Remove old nox -python3.6 -m pip uninstall --yes --quiet nox-automation +python3 -m pip uninstall --yes --quiet nox-automation # Install nox -python3.6 -m pip install --upgrade --quiet nox -python3.6 -m nox --version +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. +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then + cleanup() { + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + } + trap cleanup EXIT HUP +fi # If NOX_SESSION is set, it only runs the specified session, # otherwise run all the sessions. if [[ -n "${NOX_SESSION:-}" ]]; then - python3.6 -m nox -s "${NOX_SESSION:-}" + python3 -m nox -s ${NOX_SESSION:-} else - python3.6 -m nox + python3 -m nox fi diff --git a/.kokoro/docs/docs-presubmit.cfg b/.kokoro/docs/docs-presubmit.cfg index 11181078..bba53ed1 100644 --- a/.kokoro/docs/docs-presubmit.cfg +++ b/.kokoro/docs/docs-presubmit.cfg @@ -15,3 +15,14 @@ env_vars: { key: "TRAMPOLINE_IMAGE_UPLOAD" value: "false" } + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-dlp/.kokoro/build.sh" +} + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "docs docfx" +} diff --git a/.kokoro/samples/python3.6/periodic-head.cfg b/.kokoro/samples/python3.6/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.6/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.7/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.8/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh new file mode 100755 index 00000000..a9cc060f --- /dev/null +++ b/.kokoro/test-samples-against-head.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# 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 +# +# https://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. + +# A customized test runner for samples. +# +# For periodic builds, you can specify this file for testing against head. + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-dlp + +exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh new file mode 100755 index 00000000..cf5de74c --- /dev/null +++ b/.kokoro/test-samples-impl.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# 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 +# +# https://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. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +# Exit early if samples directory doesn't exist +if [ ! -d "./samples" ]; then + echo "No tests run. `./samples` not found" + exit 0 +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + 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. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index fe8f68e7..bf9d4c42 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# The default test runner for samples. +# +# For periodic builds, we rewinds the repo to the latest release, and +# run test-samples-impl.sh. # `-e` enables the script to automatically fail when a command fails # `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero @@ -24,87 +28,19 @@ cd github/python-dlp # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + # preserving the test runner implementation. + cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh" + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + echo "Now we rewind the repo back to the latest release..." LATEST_RELEASE=$(git describe --abbrev=0 --tags) git checkout $LATEST_RELEASE -fi - -# Exit early if samples directory doesn't exist -if [ ! -d "./samples" ]; then - echo "No tests run. `./samples` not found" - exit 0 -fi - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Debug: show build environment -env | grep KOKORO - -# Install nox -python3.6 -m pip install --upgrade --quiet nox - -# Use secrets acessor service account to get secrets -if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then - gcloud auth activate-service-account \ - --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ - --project="cloud-devrel-kokoro-resources" -fi - -# This script will create 3 files: -# - testing/test-env.sh -# - testing/service-account.json -# - testing/client-secrets.json -./scripts/decrypt-secrets.sh - -source ./testing/test-env.sh -export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json - -# For cloud-run session, we activate the service account for gcloud sdk. -gcloud auth activate-service-account \ - --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" - -export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json - -echo -e "\n******************** TESTING PROJECTS ********************" - -# Switch to 'fail at end' to allow all tests to complete before exiting. -set +e -# Use RTN to return a non-zero value if the test fails. -RTN=0 -ROOT=$(pwd) -# Find all requirements.txt in the samples directory (may break on whitespace). -for file in samples/**/requirements.txt; do - cd "$ROOT" - # Navigate to the project folder. - file=$(dirname "$file") - cd "$file" - - echo "------------------------------------------------------------" - echo "- testing $file" - echo "------------------------------------------------------------" - - # Use nox to execute the tests for the project. - python3.6 -m nox -s "$RUN_TESTS_SESSION" - 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. - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + echo "The current head is: " + echo $(git rev-parse --verify HEAD) + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + # move back the test runner implementation if there's no file. + if [ ! -f .kokoro/test-samples-impl.sh ]; then + cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh fi +fi - if [[ $EXIT -ne 0 ]]; then - RTN=1 - echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" - else - echo -e "\n Testing completed.\n" - fi - -done -cd "$ROOT" - -# Workaround for Kokoro permissions issue: delete secrets -rm testing/{test-env.sh,client-secrets.json,service-account.json} - -exit "$RTN" +exec .kokoro/test-samples-impl.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9024b15..32302e48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 hooks: - id: flake8 diff --git a/.trampolinerc b/.trampolinerc index 995ee291..383b6ec8 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -24,6 +24,7 @@ required_envvars+=( pass_down_envvars+=( "STAGING_BUCKET" "V2_STAGING_BUCKET" + "NOX_SESSION" ) # Prevent unintentional override on the default image. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c2c37699..f116a6ae 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -70,9 +70,14 @@ We use `nox `__ to instrument our tests. - To test your changes, run unit tests with ``nox``:: $ nox -s unit-2.7 - $ nox -s unit-3.7 + $ nox -s unit-3.8 $ ... +- Args to pytest can be passed through the nox command separated by a `--`. For + example, to run a single test:: + + $ nox -s unit-3.8 -- -k + .. note:: The unit tests and system tests are described in the @@ -93,8 +98,12 @@ On Debian/Ubuntu:: ************ Coding Style ************ +- We use the automatic code formatter ``black``. You can run it using + the nox session ``blacken``. This will eliminate many lint errors. Run via:: + + $ nox -s blacken -- PEP8 compliance, with exceptions defined in the linter configuration. +- PEP8 compliance is required, with exceptions defined in the linter configuration. If you have ``nox`` installed, you can test that you have not introduced any non-compliant code via:: @@ -133,13 +142,18 @@ Running System Tests - To run system tests, you can execute:: - $ nox -s system-3.7 + # Run all system tests + $ nox -s system-3.8 $ nox -s system-2.7 + # Run a single system test + $ nox -s system-3.8 -- -k + + .. note:: System tests are only configured to run under Python 2.7 and - Python 3.7. For expediency, we do not run them in older versions + Python 3.8. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local diff --git a/LICENSE b/LICENSE index a8ee855d..d6456956 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ - Apache License + + Apache License Version 2.0, January 2004 - https://www.apache.org/licenses/ + http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -192,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + 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, diff --git a/MANIFEST.in b/MANIFEST.in index e9e29d12..e783f4c6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -16,10 +16,10 @@ # Generated by synthtool. DO NOT EDIT! include README.rst LICENSE -recursive-include google *.json *.proto +recursive-include google *.json *.proto py.typed recursive-include tests * global-exclude *.py[co] global-exclude __pycache__ # Exclude scripts for samples readmegen -prune scripts/readme-gen \ No newline at end of file +prune scripts/readme-gen diff --git a/UPGRADING.md b/UPGRADING.md index ab625aa9..f8ae9122 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -17,10 +17,10 @@ The 2.0.0 release requires Python 3.6+. Methods expect request objects. We provide a script that will convert most common use cases. -* Install the library +* Install the library and `libcst`. ```py -python3 -m pip install google-cloud-dlp +python3 -m pip install google-cloud-dlp[libcst] ``` * The script `fixup_dlp_v2_keywords.py` is shipped with the library. It expects diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 0abaf229..bcd37bbd 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,4 +1,9 @@ div#python2-eol { border-color: red; border-width: medium; -} \ No newline at end of file +} + +/* Ensure minimum width for 'Parameters' / 'Returns' column */ +dl.field-list > dt { + min-width: 100px +} diff --git a/docs/dlp_v2/dlp_service.rst b/docs/dlp_v2/dlp_service.rst new file mode 100644 index 00000000..86272ecb --- /dev/null +++ b/docs/dlp_v2/dlp_service.rst @@ -0,0 +1,11 @@ +DlpService +---------------------------- + +.. automodule:: google.cloud.dlp_v2.services.dlp_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.dlp_v2.services.dlp_service.pagers + :members: + :inherited-members: diff --git a/docs/dlp_v2/services.rst b/docs/dlp_v2/services.rst index 42476c6a..864a8c83 100644 --- a/docs/dlp_v2/services.rst +++ b/docs/dlp_v2/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Dlp v2 API ==================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.dlp_v2.services.dlp_service - :members: - :inherited-members: + dlp_service diff --git a/docs/dlp_v2/types.rst b/docs/dlp_v2/types.rst index 5470b717..f2a1a4f5 100644 --- a/docs/dlp_v2/types.rst +++ b/docs/dlp_v2/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Dlp v2 API .. automodule:: google.cloud.dlp_v2.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/dlp_v2/services/dlp_service/async_client.py b/google/cloud/dlp_v2/services/dlp_service/async_client.py index a8048473..30ffb82f 100644 --- a/google/cloud/dlp_v2/services/dlp_service/async_client.py +++ b/google/cloud/dlp_v2/services/dlp_service/async_client.py @@ -99,7 +99,36 @@ class DlpServiceAsyncClient: DlpServiceClient.parse_common_location_path ) - from_service_account_file = DlpServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DlpServiceAsyncClient: The constructed client. + """ + return DlpServiceClient.from_service_account_info.__func__(DlpServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DlpServiceAsyncClient: The constructed client. + """ + return DlpServiceClient.from_service_account_file.__func__(DlpServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property @@ -183,7 +212,7 @@ async def inspect_content( https://cloud.google.com/dlp/docs/inspecting-text, Args: - request (:class:`~.dlp.InspectContentRequest`): + request (:class:`google.cloud.dlp_v2.types.InspectContentRequest`): The request object. Request to search for potentially sensitive info in a ContentItem. @@ -194,7 +223,7 @@ async def inspect_content( sent along with the request as metadata. Returns: - ~.dlp.InspectContentResponse: + google.cloud.dlp_v2.types.InspectContentResponse: Results of inspecting an item. """ # Create or coerce a protobuf request object. @@ -212,6 +241,7 @@ async def inspect_content( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -249,7 +279,7 @@ async def redact_image( may change over time as detectors are updated. Args: - request (:class:`~.dlp.RedactImageRequest`): + request (:class:`google.cloud.dlp_v2.types.RedactImageRequest`): The request object. Request to search for potentially sensitive info in an image and redact it by covering it with a colored rectangle. @@ -261,7 +291,7 @@ async def redact_image( sent along with the request as metadata. Returns: - ~.dlp.RedactImageResponse: + google.cloud.dlp_v2.types.RedactImageResponse: Results of redacting an image. """ # Create or coerce a protobuf request object. @@ -279,6 +309,7 @@ async def redact_image( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -316,7 +347,7 @@ async def deidentify_content( may change over time as detectors are updated. Args: - request (:class:`~.dlp.DeidentifyContentRequest`): + request (:class:`google.cloud.dlp_v2.types.DeidentifyContentRequest`): The request object. Request to de-identify a list of items. @@ -327,7 +358,7 @@ async def deidentify_content( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyContentResponse: + google.cloud.dlp_v2.types.DeidentifyContentResponse: Results of de-identifying a ContentItem. @@ -347,6 +378,7 @@ async def deidentify_content( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -377,7 +409,7 @@ async def reidentify_content( to learn more. Args: - request (:class:`~.dlp.ReidentifyContentRequest`): + request (:class:`google.cloud.dlp_v2.types.ReidentifyContentRequest`): The request object. Request to re-identify an item. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -387,7 +419,7 @@ async def reidentify_content( sent along with the request as metadata. Returns: - ~.dlp.ReidentifyContentResponse: + google.cloud.dlp_v2.types.ReidentifyContentResponse: Results of re-identifying a item. """ # Create or coerce a protobuf request object. @@ -405,6 +437,7 @@ async def reidentify_content( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -437,7 +470,7 @@ async def list_info_types( learn more. Args: - request (:class:`~.dlp.ListInfoTypesRequest`): + request (:class:`google.cloud.dlp_v2.types.ListInfoTypesRequest`): The request object. Request for the list of infoTypes. parent (:class:`str`): The parent resource name. @@ -447,6 +480,7 @@ async def list_info_types( :: locations/LOCATION_ID + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -458,7 +492,7 @@ async def list_info_types( sent along with the request as metadata. Returns: - ~.dlp.ListInfoTypesResponse: + google.cloud.dlp_v2.types.ListInfoTypesResponse: Response to the ListInfoTypes request. @@ -492,6 +526,7 @@ async def list_info_types( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -519,7 +554,7 @@ async def create_inspect_template( templates to learn more. Args: - request (:class:`~.dlp.CreateInspectTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.CreateInspectTemplateRequest`): The request object. Request message for CreateInspectTemplate. parent (:class:`str`): @@ -547,12 +582,14 @@ async def create_inspect_template( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_template (:class:`~.dlp.InspectTemplate`): + inspect_template (:class:`google.cloud.dlp_v2.types.InspectTemplate`): Required. The InspectTemplate to create. + This corresponds to the ``inspect_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -564,7 +601,7 @@ async def create_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -630,7 +667,7 @@ async def update_inspect_template( to learn more. Args: - request (:class:`~.dlp.UpdateInspectTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.UpdateInspectTemplateRequest`): The request object. Request message for UpdateInspectTemplate. name (:class:`str`): @@ -638,17 +675,19 @@ async def update_inspect_template( inspectTemplate to be updated, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_template (:class:`~.dlp.InspectTemplate`): + inspect_template (:class:`google.cloud.dlp_v2.types.InspectTemplate`): New InspectTemplate value. This corresponds to the ``inspect_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -660,7 +699,7 @@ async def update_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -726,7 +765,7 @@ async def get_inspect_template( to learn more. Args: - request (:class:`~.dlp.GetInspectTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.GetInspectTemplateRequest`): The request object. Request message for GetInspectTemplate. name (:class:`str`): @@ -734,6 +773,7 @@ async def get_inspect_template( inspectTemplate to be read, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -745,7 +785,7 @@ async def get_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -784,6 +824,7 @@ async def get_inspect_template( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -815,7 +856,7 @@ async def list_inspect_templates( to learn more. Args: - request (:class:`~.dlp.ListInspectTemplatesRequest`): + request (:class:`google.cloud.dlp_v2.types.ListInspectTemplatesRequest`): The request object. Request message for ListInspectTemplates. parent (:class:`str`): @@ -843,6 +884,7 @@ async def list_inspect_templates( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -854,7 +896,7 @@ async def list_inspect_templates( sent along with the request as metadata. Returns: - ~.pagers.ListInspectTemplatesAsyncPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListInspectTemplatesAsyncPager: Response message for ListInspectTemplates. Iterating over this object will yield @@ -891,6 +933,7 @@ async def list_inspect_templates( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -928,7 +971,7 @@ async def delete_inspect_template( to learn more. Args: - request (:class:`~.dlp.DeleteInspectTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.DeleteInspectTemplateRequest`): The request object. Request message for DeleteInspectTemplate. name (:class:`str`): @@ -936,6 +979,7 @@ async def delete_inspect_template( inspectTemplate to be deleted, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -975,6 +1019,7 @@ async def delete_inspect_template( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1008,7 +1053,7 @@ async def create_deidentify_template( deid to learn more. Args: - request (:class:`~.dlp.CreateDeidentifyTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.CreateDeidentifyTemplateRequest`): The request object. Request message for CreateDeidentifyTemplate. parent (:class:`str`): @@ -1036,12 +1081,14 @@ async def create_deidentify_template( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - deidentify_template (:class:`~.dlp.DeidentifyTemplate`): + deidentify_template (:class:`google.cloud.dlp_v2.types.DeidentifyTemplate`): Required. The DeidentifyTemplate to create. + This corresponds to the ``deidentify_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1053,7 +1100,7 @@ async def create_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1117,7 +1164,7 @@ async def update_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.UpdateDeidentifyTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.UpdateDeidentifyTemplateRequest`): The request object. Request message for UpdateDeidentifyTemplate. name (:class:`str`): @@ -1125,17 +1172,19 @@ async def update_deidentify_template( template to be updated, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - deidentify_template (:class:`~.dlp.DeidentifyTemplate`): + deidentify_template (:class:`google.cloud.dlp_v2.types.DeidentifyTemplate`): New DeidentifyTemplate value. This corresponds to the ``deidentify_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1147,7 +1196,7 @@ async def update_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1211,7 +1260,7 @@ async def get_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.GetDeidentifyTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.GetDeidentifyTemplateRequest`): The request object. Request message for GetDeidentifyTemplate. name (:class:`str`): @@ -1219,6 +1268,7 @@ async def get_deidentify_template( deidentify template to be read, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1230,7 +1280,7 @@ async def get_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1267,6 +1317,7 @@ async def get_deidentify_template( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1298,7 +1349,7 @@ async def list_deidentify_templates( templates-deid to learn more. Args: - request (:class:`~.dlp.ListDeidentifyTemplatesRequest`): + request (:class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest`): The request object. Request message for ListDeidentifyTemplates. parent (:class:`str`): @@ -1326,6 +1377,7 @@ async def list_deidentify_templates( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1337,7 +1389,7 @@ async def list_deidentify_templates( sent along with the request as metadata. Returns: - ~.pagers.ListDeidentifyTemplatesAsyncPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListDeidentifyTemplatesAsyncPager: Response message for ListDeidentifyTemplates. Iterating over this object will yield @@ -1374,6 +1426,7 @@ async def list_deidentify_templates( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1411,7 +1464,7 @@ async def delete_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.DeleteDeidentifyTemplateRequest`): + request (:class:`google.cloud.dlp_v2.types.DeleteDeidentifyTemplateRequest`): The request object. Request message for DeleteDeidentifyTemplate. name (:class:`str`): @@ -1419,6 +1472,7 @@ async def delete_deidentify_template( deidentify template to be deleted, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1458,6 +1512,7 @@ async def delete_deidentify_template( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1491,7 +1546,7 @@ async def create_job_trigger( to learn more. Args: - request (:class:`~.dlp.CreateJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.CreateJobTriggerRequest`): The request object. Request message for CreateJobTrigger. parent (:class:`str`): @@ -1514,10 +1569,11 @@ async def create_job_trigger( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job_trigger (:class:`~.dlp.JobTrigger`): + job_trigger (:class:`google.cloud.dlp_v2.types.JobTrigger`): Required. The JobTrigger to create. This corresponds to the ``job_trigger`` field on the ``request`` instance; if ``request`` is provided, this @@ -1530,7 +1586,7 @@ async def create_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -1593,24 +1649,26 @@ async def update_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.UpdateJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.UpdateJobTriggerRequest`): The request object. Request message for UpdateJobTrigger. name (:class:`str`): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job_trigger (:class:`~.dlp.JobTrigger`): + job_trigger (:class:`google.cloud.dlp_v2.types.JobTrigger`): New JobTrigger value. This corresponds to the ``job_trigger`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1622,7 +1680,7 @@ async def update_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -1690,13 +1748,14 @@ async def hybrid_inspect_job_trigger( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.HybridInspectJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.HybridInspectJobTriggerRequest`): The request object. Request to search for potentially sensitive info in a custom location. name (:class:`str`): Required. Resource name of the trigger to execute a hybrid inspect on, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1708,7 +1767,7 @@ async def hybrid_inspect_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.HybridInspectResponse: + google.cloud.dlp_v2.types.HybridInspectResponse: Quota exceeded errors will be thrown once quota has been met. @@ -1765,12 +1824,13 @@ async def get_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.GetJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.GetJobTriggerRequest`): The request object. Request message for GetJobTrigger. name (:class:`str`): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1782,7 +1842,7 @@ async def get_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -1818,6 +1878,7 @@ async def get_job_trigger( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1849,7 +1910,7 @@ async def list_job_triggers( triggers to learn more. Args: - request (:class:`~.dlp.ListJobTriggersRequest`): + request (:class:`google.cloud.dlp_v2.types.ListJobTriggersRequest`): The request object. Request message for ListJobTriggers. parent (:class:`str`): Required. Parent resource name. @@ -1871,6 +1932,7 @@ async def list_job_triggers( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1882,7 +1944,7 @@ async def list_job_triggers( sent along with the request as metadata. Returns: - ~.pagers.ListJobTriggersAsyncPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListJobTriggersAsyncPager: Response message for ListJobTriggers. Iterating over this object will yield results and resolve additional pages @@ -1918,6 +1980,7 @@ async def list_job_triggers( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -1955,13 +2018,14 @@ async def delete_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.DeleteJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.DeleteJobTriggerRequest`): The request object. Request message for DeleteJobTrigger. name (:class:`str`): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2001,6 +2065,7 @@ async def delete_job_trigger( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2030,7 +2095,7 @@ async def activate_job_trigger( occur. Args: - request (:class:`~.dlp.ActivateJobTriggerRequest`): + request (:class:`google.cloud.dlp_v2.types.ActivateJobTriggerRequest`): The request object. Request message for ActivateJobTrigger. @@ -2041,7 +2106,7 @@ async def activate_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2092,7 +2157,7 @@ async def create_dlp_job( may change over time as detectors are updated. Args: - request (:class:`~.dlp.CreateDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.CreateDlpJobRequest`): The request object. Request message for CreateDlpJobRequest. Used to initiate long running jobs such as calculating risk metrics or inspecting Google @@ -2117,18 +2182,21 @@ async def create_dlp_job( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_job (:class:`~.dlp.InspectJobConfig`): + inspect_job (:class:`google.cloud.dlp_v2.types.InspectJobConfig`): Set to control what and how to inspect. + This corresponds to the ``inspect_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - risk_job (:class:`~.dlp.RiskAnalysisJobConfig`): + risk_job (:class:`google.cloud.dlp_v2.types.RiskAnalysisJobConfig`): Set to choose what metric to calculate. + This corresponds to the ``risk_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2140,7 +2208,7 @@ async def create_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2203,7 +2271,7 @@ async def list_dlp_jobs( to learn more. Args: - request (:class:`~.dlp.ListDlpJobsRequest`): + request (:class:`google.cloud.dlp_v2.types.ListDlpJobsRequest`): The request object. The request message for listing DLP jobs. parent (:class:`str`): @@ -2226,6 +2294,7 @@ async def list_dlp_jobs( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2237,7 +2306,7 @@ async def list_dlp_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListDlpJobsAsyncPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListDlpJobsAsyncPager: The response message for listing DLP jobs. Iterating over this object will yield @@ -2274,6 +2343,7 @@ async def list_dlp_jobs( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2312,12 +2382,13 @@ async def get_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.GetDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.GetDlpJobRequest`): The request object. The request message for [DlpJobs.GetDlpJob][]. name (:class:`str`): Required. The name of the DlpJob resource. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2329,7 +2400,7 @@ async def get_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2363,6 +2434,7 @@ async def get_dlp_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2397,12 +2469,13 @@ async def delete_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.DeleteDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.DeleteDlpJobRequest`): The request object. The request message for deleting a DLP job. name (:class:`str`): Required. The name of the DlpJob resource to be deleted. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2442,6 +2515,7 @@ async def delete_dlp_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2474,7 +2548,7 @@ async def cancel_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.CancelDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.CancelDlpJobRequest`): The request object. The request message for canceling a DLP job. @@ -2523,7 +2597,7 @@ async def create_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.CreateStoredInfoTypeRequest`): + request (:class:`google.cloud.dlp_v2.types.CreateStoredInfoTypeRequest`): The request object. Request message for CreateStoredInfoType. parent (:class:`str`): @@ -2551,12 +2625,14 @@ async def create_stored_info_type( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - config (:class:`~.dlp.StoredInfoTypeConfig`): + config (:class:`google.cloud.dlp_v2.types.StoredInfoTypeConfig`): Required. Configuration of the storedInfoType to create. + This corresponds to the ``config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2568,7 +2644,7 @@ async def create_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2632,7 +2708,7 @@ async def update_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.UpdateStoredInfoTypeRequest`): + request (:class:`google.cloud.dlp_v2.types.UpdateStoredInfoTypeRequest`): The request object. Request message for UpdateStoredInfoType. name (:class:`str`): @@ -2640,20 +2716,23 @@ async def update_stored_info_type( storedInfoType to be updated, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - config (:class:`~.dlp.StoredInfoTypeConfig`): + config (:class:`google.cloud.dlp_v2.types.StoredInfoTypeConfig`): Updated configuration for the storedInfoType. If not provided, a new version of the storedInfoType will be created with the existing configuration. + This corresponds to the ``config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2665,7 +2744,7 @@ async def update_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2727,7 +2806,7 @@ async def get_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.GetStoredInfoTypeRequest`): + request (:class:`google.cloud.dlp_v2.types.GetStoredInfoTypeRequest`): The request object. Request message for GetStoredInfoType. name (:class:`str`): @@ -2735,6 +2814,7 @@ async def get_stored_info_type( storedInfoType to be read, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2746,7 +2826,7 @@ async def get_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2781,6 +2861,7 @@ async def get_stored_info_type( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2812,7 +2893,7 @@ async def list_stored_info_types( infotypes to learn more. Args: - request (:class:`~.dlp.ListStoredInfoTypesRequest`): + request (:class:`google.cloud.dlp_v2.types.ListStoredInfoTypesRequest`): The request object. Request message for ListStoredInfoTypes. parent (:class:`str`): @@ -2840,6 +2921,7 @@ async def list_stored_info_types( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2851,7 +2933,7 @@ async def list_stored_info_types( sent along with the request as metadata. Returns: - ~.pagers.ListStoredInfoTypesAsyncPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListStoredInfoTypesAsyncPager: Response message for ListStoredInfoTypes. Iterating over this object will yield @@ -2888,6 +2970,7 @@ async def list_stored_info_types( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -2925,7 +3008,7 @@ async def delete_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.DeleteStoredInfoTypeRequest`): + request (:class:`google.cloud.dlp_v2.types.DeleteStoredInfoTypeRequest`): The request object. Request message for DeleteStoredInfoType. name (:class:`str`): @@ -2933,6 +3016,7 @@ async def delete_stored_info_type( storedInfoType to be deleted, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2972,6 +3056,7 @@ async def delete_stored_info_type( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, @@ -3006,13 +3091,14 @@ async def hybrid_inspect_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.HybridInspectDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.HybridInspectDlpJobRequest`): The request object. Request to search for potentially sensitive info in a custom location. name (:class:`str`): Required. Resource name of the job to execute a hybrid inspect on, for example ``projects/dlp-test-project/dlpJob/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3024,7 +3110,7 @@ async def hybrid_inspect_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.HybridInspectResponse: + google.cloud.dlp_v2.types.HybridInspectResponse: Quota exceeded errors will be thrown once quota has been met. @@ -3083,7 +3169,7 @@ async def finish_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.FinishDlpJobRequest`): + request (:class:`google.cloud.dlp_v2.types.FinishDlpJobRequest`): The request object. The request message for finishing a DLP hybrid job. diff --git a/google/cloud/dlp_v2/services/dlp_service/client.py b/google/cloud/dlp_v2/services/dlp_service/client.py index 7f0355f8..12fa3463 100644 --- a/google/cloud/dlp_v2/services/dlp_service/client.py +++ b/google/cloud/dlp_v2/services/dlp_service/client.py @@ -119,6 +119,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DlpServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -131,7 +147,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + DlpServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -326,10 +342,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.DlpServiceTransport]): The + transport (Union[str, DlpServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -365,21 +381,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -422,7 +434,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -447,7 +459,7 @@ def inspect_content( https://cloud.google.com/dlp/docs/inspecting-text, Args: - request (:class:`~.dlp.InspectContentRequest`): + request (google.cloud.dlp_v2.types.InspectContentRequest): The request object. Request to search for potentially sensitive info in a ContentItem. @@ -458,7 +470,7 @@ def inspect_content( sent along with the request as metadata. Returns: - ~.dlp.InspectContentResponse: + google.cloud.dlp_v2.types.InspectContentResponse: Results of inspecting an item. """ # Create or coerce a protobuf request object. @@ -506,7 +518,7 @@ def redact_image( may change over time as detectors are updated. Args: - request (:class:`~.dlp.RedactImageRequest`): + request (google.cloud.dlp_v2.types.RedactImageRequest): The request object. Request to search for potentially sensitive info in an image and redact it by covering it with a colored rectangle. @@ -518,7 +530,7 @@ def redact_image( sent along with the request as metadata. Returns: - ~.dlp.RedactImageResponse: + google.cloud.dlp_v2.types.RedactImageResponse: Results of redacting an image. """ # Create or coerce a protobuf request object. @@ -566,7 +578,7 @@ def deidentify_content( may change over time as detectors are updated. Args: - request (:class:`~.dlp.DeidentifyContentRequest`): + request (google.cloud.dlp_v2.types.DeidentifyContentRequest): The request object. Request to de-identify a list of items. @@ -577,7 +589,7 @@ def deidentify_content( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyContentResponse: + google.cloud.dlp_v2.types.DeidentifyContentResponse: Results of de-identifying a ContentItem. @@ -620,7 +632,7 @@ def reidentify_content( to learn more. Args: - request (:class:`~.dlp.ReidentifyContentRequest`): + request (google.cloud.dlp_v2.types.ReidentifyContentRequest): The request object. Request to re-identify an item. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -630,7 +642,7 @@ def reidentify_content( sent along with the request as metadata. Returns: - ~.dlp.ReidentifyContentResponse: + google.cloud.dlp_v2.types.ReidentifyContentResponse: Results of re-identifying a item. """ # Create or coerce a protobuf request object. @@ -673,9 +685,9 @@ def list_info_types( learn more. Args: - request (:class:`~.dlp.ListInfoTypesRequest`): + request (google.cloud.dlp_v2.types.ListInfoTypesRequest): The request object. Request for the list of infoTypes. - parent (:class:`str`): + parent (str): The parent resource name. The format of this value is as follows: @@ -683,6 +695,7 @@ def list_info_types( :: locations/LOCATION_ID + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -694,7 +707,7 @@ def list_info_types( sent along with the request as metadata. Returns: - ~.dlp.ListInfoTypesResponse: + google.cloud.dlp_v2.types.ListInfoTypesResponse: Response to the ListInfoTypes request. @@ -748,10 +761,10 @@ def create_inspect_template( templates to learn more. Args: - request (:class:`~.dlp.CreateInspectTemplateRequest`): + request (google.cloud.dlp_v2.types.CreateInspectTemplateRequest): The request object. Request message for CreateInspectTemplate. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -776,12 +789,14 @@ def create_inspect_template( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_template (:class:`~.dlp.InspectTemplate`): + inspect_template (google.cloud.dlp_v2.types.InspectTemplate): Required. The InspectTemplate to create. + This corresponds to the ``inspect_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -793,7 +808,7 @@ def create_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -860,25 +875,27 @@ def update_inspect_template( to learn more. Args: - request (:class:`~.dlp.UpdateInspectTemplateRequest`): + request (google.cloud.dlp_v2.types.UpdateInspectTemplateRequest): The request object. Request message for UpdateInspectTemplate. - name (:class:`str`): + name (str): Required. Resource name of organization and inspectTemplate to be updated, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_template (:class:`~.dlp.InspectTemplate`): + inspect_template (google.cloud.dlp_v2.types.InspectTemplate): New InspectTemplate value. This corresponds to the ``inspect_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -890,7 +907,7 @@ def update_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -957,14 +974,15 @@ def get_inspect_template( to learn more. Args: - request (:class:`~.dlp.GetInspectTemplateRequest`): + request (google.cloud.dlp_v2.types.GetInspectTemplateRequest): The request object. Request message for GetInspectTemplate. - name (:class:`str`): + name (str): Required. Resource name of the organization and inspectTemplate to be read, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -976,7 +994,7 @@ def get_inspect_template( sent along with the request as metadata. Returns: - ~.dlp.InspectTemplate: + google.cloud.dlp_v2.types.InspectTemplate: The inspectTemplate contains a configuration (set of types of sensitive data to be detected) to be used anywhere @@ -1039,10 +1057,10 @@ def list_inspect_templates( to learn more. Args: - request (:class:`~.dlp.ListInspectTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListInspectTemplatesRequest): The request object. Request message for ListInspectTemplates. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -1067,6 +1085,7 @@ def list_inspect_templates( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1078,7 +1097,7 @@ def list_inspect_templates( sent along with the request as metadata. Returns: - ~.pagers.ListInspectTemplatesPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListInspectTemplatesPager: Response message for ListInspectTemplates. Iterating over this object will yield @@ -1145,14 +1164,15 @@ def delete_inspect_template( to learn more. Args: - request (:class:`~.dlp.DeleteInspectTemplateRequest`): + request (google.cloud.dlp_v2.types.DeleteInspectTemplateRequest): The request object. Request message for DeleteInspectTemplate. - name (:class:`str`): + name (str): Required. Resource name of the organization and inspectTemplate to be deleted, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1218,10 +1238,10 @@ def create_deidentify_template( deid to learn more. Args: - request (:class:`~.dlp.CreateDeidentifyTemplateRequest`): + request (google.cloud.dlp_v2.types.CreateDeidentifyTemplateRequest): The request object. Request message for CreateDeidentifyTemplate. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -1246,12 +1266,14 @@ def create_deidentify_template( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - deidentify_template (:class:`~.dlp.DeidentifyTemplate`): + deidentify_template (google.cloud.dlp_v2.types.DeidentifyTemplate): Required. The DeidentifyTemplate to create. + This corresponds to the ``deidentify_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1263,7 +1285,7 @@ def create_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1330,25 +1352,27 @@ def update_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.UpdateDeidentifyTemplateRequest`): + request (google.cloud.dlp_v2.types.UpdateDeidentifyTemplateRequest): The request object. Request message for UpdateDeidentifyTemplate. - name (:class:`str`): + name (str): Required. Resource name of organization and deidentify template to be updated, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - deidentify_template (:class:`~.dlp.DeidentifyTemplate`): + deidentify_template (google.cloud.dlp_v2.types.DeidentifyTemplate): New DeidentifyTemplate value. This corresponds to the ``deidentify_template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1360,7 +1384,7 @@ def update_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1427,14 +1451,15 @@ def get_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.GetDeidentifyTemplateRequest`): + request (google.cloud.dlp_v2.types.GetDeidentifyTemplateRequest): The request object. Request message for GetDeidentifyTemplate. - name (:class:`str`): + name (str): Required. Resource name of the organization and deidentify template to be read, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1446,7 +1471,7 @@ def get_deidentify_template( sent along with the request as metadata. Returns: - ~.dlp.DeidentifyTemplate: + google.cloud.dlp_v2.types.DeidentifyTemplate: DeidentifyTemplates contains instructions on how to de-identify content. See @@ -1507,10 +1532,10 @@ def list_deidentify_templates( templates-deid to learn more. Args: - request (:class:`~.dlp.ListDeidentifyTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest): The request object. Request message for ListDeidentifyTemplates. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -1535,6 +1560,7 @@ def list_deidentify_templates( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1546,7 +1572,7 @@ def list_deidentify_templates( sent along with the request as metadata. Returns: - ~.pagers.ListDeidentifyTemplatesPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListDeidentifyTemplatesPager: Response message for ListDeidentifyTemplates. Iterating over this object will yield @@ -1615,14 +1641,15 @@ def delete_deidentify_template( templates-deid to learn more. Args: - request (:class:`~.dlp.DeleteDeidentifyTemplateRequest`): + request (google.cloud.dlp_v2.types.DeleteDeidentifyTemplateRequest): The request object. Request message for DeleteDeidentifyTemplate. - name (:class:`str`): + name (str): Required. Resource name of the organization and deidentify template to be deleted, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1690,10 +1717,10 @@ def create_job_trigger( to learn more. Args: - request (:class:`~.dlp.CreateJobTriggerRequest`): + request (google.cloud.dlp_v2.types.CreateJobTriggerRequest): The request object. Request message for CreateJobTrigger. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on whether you @@ -1713,10 +1740,11 @@ def create_job_trigger( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job_trigger (:class:`~.dlp.JobTrigger`): + job_trigger (google.cloud.dlp_v2.types.JobTrigger): Required. The JobTrigger to create. This corresponds to the ``job_trigger`` field on the ``request`` instance; if ``request`` is provided, this @@ -1729,7 +1757,7 @@ def create_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -1793,24 +1821,26 @@ def update_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.UpdateJobTriggerRequest`): + request (google.cloud.dlp_v2.types.UpdateJobTriggerRequest): The request object. Request message for UpdateJobTrigger. - name (:class:`str`): + name (str): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job_trigger (:class:`~.dlp.JobTrigger`): + job_trigger (google.cloud.dlp_v2.types.JobTrigger): New JobTrigger value. This corresponds to the ``job_trigger`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1822,7 +1852,7 @@ def update_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -1891,13 +1921,14 @@ def hybrid_inspect_job_trigger( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.HybridInspectJobTriggerRequest`): + request (google.cloud.dlp_v2.types.HybridInspectJobTriggerRequest): The request object. Request to search for potentially sensitive info in a custom location. - name (:class:`str`): + name (str): Required. Resource name of the trigger to execute a hybrid inspect on, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1909,7 +1940,7 @@ def hybrid_inspect_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.HybridInspectResponse: + google.cloud.dlp_v2.types.HybridInspectResponse: Quota exceeded errors will be thrown once quota has been met. @@ -1969,12 +2000,13 @@ def get_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.GetJobTriggerRequest`): + request (google.cloud.dlp_v2.types.GetJobTriggerRequest): The request object. Request message for GetJobTrigger. - name (:class:`str`): + name (str): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1986,7 +2018,7 @@ def get_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.JobTrigger: + google.cloud.dlp_v2.types.JobTrigger: Contains a configuration to make dlp api calls on a repeating basis. See https://cloud.google.com/dlp/docs/concepts- @@ -2046,9 +2078,9 @@ def list_job_triggers( triggers to learn more. Args: - request (:class:`~.dlp.ListJobTriggersRequest`): + request (google.cloud.dlp_v2.types.ListJobTriggersRequest): The request object. Request message for ListJobTriggers. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on whether you @@ -2068,6 +2100,7 @@ def list_job_triggers( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2079,7 +2112,7 @@ def list_job_triggers( sent along with the request as metadata. Returns: - ~.pagers.ListJobTriggersPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListJobTriggersPager: Response message for ListJobTriggers. Iterating over this object will yield results and resolve additional pages @@ -2145,13 +2178,14 @@ def delete_job_trigger( triggers to learn more. Args: - request (:class:`~.dlp.DeleteJobTriggerRequest`): + request (google.cloud.dlp_v2.types.DeleteJobTriggerRequest): The request object. Request message for DeleteJobTrigger. - name (:class:`str`): + name (str): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2213,7 +2247,7 @@ def activate_job_trigger( occur. Args: - request (:class:`~.dlp.ActivateJobTriggerRequest`): + request (google.cloud.dlp_v2.types.ActivateJobTriggerRequest): The request object. Request message for ActivateJobTrigger. @@ -2224,7 +2258,7 @@ def activate_job_trigger( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2276,12 +2310,12 @@ def create_dlp_job( may change over time as detectors are updated. Args: - request (:class:`~.dlp.CreateDlpJobRequest`): + request (google.cloud.dlp_v2.types.CreateDlpJobRequest): The request object. Request message for CreateDlpJobRequest. Used to initiate long running jobs such as calculating risk metrics or inspecting Google Cloud Storage. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on whether you @@ -2301,18 +2335,21 @@ def create_dlp_job( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - inspect_job (:class:`~.dlp.InspectJobConfig`): + inspect_job (google.cloud.dlp_v2.types.InspectJobConfig): Set to control what and how to inspect. + This corresponds to the ``inspect_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - risk_job (:class:`~.dlp.RiskAnalysisJobConfig`): + risk_job (google.cloud.dlp_v2.types.RiskAnalysisJobConfig): Set to choose what metric to calculate. + This corresponds to the ``risk_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2324,7 +2361,7 @@ def create_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2388,10 +2425,10 @@ def list_dlp_jobs( to learn more. Args: - request (:class:`~.dlp.ListDlpJobsRequest`): + request (google.cloud.dlp_v2.types.ListDlpJobsRequest): The request object. The request message for listing DLP jobs. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on whether you @@ -2411,6 +2448,7 @@ def list_dlp_jobs( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2422,7 +2460,7 @@ def list_dlp_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListDlpJobsPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListDlpJobsPager: The response message for listing DLP jobs. Iterating over this object will yield @@ -2490,12 +2528,13 @@ def get_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.GetDlpJobRequest`): + request (google.cloud.dlp_v2.types.GetDlpJobRequest): The request object. The request message for [DlpJobs.GetDlpJob][]. - name (:class:`str`): + name (str): Required. The name of the DlpJob resource. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2507,7 +2546,7 @@ def get_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.DlpJob: + google.cloud.dlp_v2.types.DlpJob: Combines all of the information about a DLP job. @@ -2568,12 +2607,13 @@ def delete_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.DeleteDlpJobRequest`): + request (google.cloud.dlp_v2.types.DeleteDlpJobRequest): The request object. The request message for deleting a DLP job. - name (:class:`str`): + name (str): Required. The name of the DlpJob resource to be deleted. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2638,7 +2678,7 @@ def cancel_dlp_job( analysis to learn more. Args: - request (:class:`~.dlp.CancelDlpJobRequest`): + request (google.cloud.dlp_v2.types.CancelDlpJobRequest): The request object. The request message for canceling a DLP job. @@ -2688,10 +2728,10 @@ def create_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.CreateStoredInfoTypeRequest`): + request (google.cloud.dlp_v2.types.CreateStoredInfoTypeRequest): The request object. Request message for CreateStoredInfoType. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -2716,12 +2756,14 @@ def create_stored_info_type( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - config (:class:`~.dlp.StoredInfoTypeConfig`): + config (google.cloud.dlp_v2.types.StoredInfoTypeConfig): Required. Configuration of the storedInfoType to create. + This corresponds to the ``config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2733,7 +2775,7 @@ def create_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2798,28 +2840,31 @@ def update_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.UpdateStoredInfoTypeRequest`): + request (google.cloud.dlp_v2.types.UpdateStoredInfoTypeRequest): The request object. Request message for UpdateStoredInfoType. - name (:class:`str`): + name (str): Required. Resource name of organization and storedInfoType to be updated, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - config (:class:`~.dlp.StoredInfoTypeConfig`): + config (google.cloud.dlp_v2.types.StoredInfoTypeConfig): Updated configuration for the storedInfoType. If not provided, a new version of the storedInfoType will be created with the existing configuration. + This corresponds to the ``config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2831,7 +2876,7 @@ def update_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2894,14 +2939,15 @@ def get_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.GetStoredInfoTypeRequest`): + request (google.cloud.dlp_v2.types.GetStoredInfoTypeRequest): The request object. Request message for GetStoredInfoType. - name (:class:`str`): + name (str): Required. Resource name of the organization and storedInfoType to be read, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2913,7 +2959,7 @@ def get_stored_info_type( sent along with the request as metadata. Returns: - ~.dlp.StoredInfoType: + google.cloud.dlp_v2.types.StoredInfoType: StoredInfoType resource message that contains information about the current version and any pending updates. @@ -2972,10 +3018,10 @@ def list_stored_info_types( infotypes to learn more. Args: - request (:class:`~.dlp.ListStoredInfoTypesRequest`): + request (google.cloud.dlp_v2.types.ListStoredInfoTypesRequest): The request object. Request message for ListStoredInfoTypes. - parent (:class:`str`): + parent (str): Required. Parent resource name. The format of this value varies depending on the scope @@ -3000,6 +3046,7 @@ def list_stored_info_types( :: parent=projects/example-project/locations/europe-west3 + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3011,7 +3058,7 @@ def list_stored_info_types( sent along with the request as metadata. Returns: - ~.pagers.ListStoredInfoTypesPager: + google.cloud.dlp_v2.services.dlp_service.pagers.ListStoredInfoTypesPager: Response message for ListStoredInfoTypes. Iterating over this object will yield @@ -3078,14 +3125,15 @@ def delete_stored_info_type( infotypes to learn more. Args: - request (:class:`~.dlp.DeleteStoredInfoTypeRequest`): + request (google.cloud.dlp_v2.types.DeleteStoredInfoTypeRequest): The request object. Request message for DeleteStoredInfoType. - name (:class:`str`): + name (str): Required. Resource name of the organization and storedInfoType to be deleted, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3152,13 +3200,14 @@ def hybrid_inspect_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.HybridInspectDlpJobRequest`): + request (google.cloud.dlp_v2.types.HybridInspectDlpJobRequest): The request object. Request to search for potentially sensitive info in a custom location. - name (:class:`str`): + name (str): Required. Resource name of the job to execute a hybrid inspect on, for example ``projects/dlp-test-project/dlpJob/53234423``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3170,7 +3219,7 @@ def hybrid_inspect_dlp_job( sent along with the request as metadata. Returns: - ~.dlp.HybridInspectResponse: + google.cloud.dlp_v2.types.HybridInspectResponse: Quota exceeded errors will be thrown once quota has been met. @@ -3230,7 +3279,7 @@ def finish_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`~.dlp.FinishDlpJobRequest`): + request (google.cloud.dlp_v2.types.FinishDlpJobRequest): The request object. The request message for finishing a DLP hybrid job. diff --git a/google/cloud/dlp_v2/services/dlp_service/pagers.py b/google/cloud/dlp_v2/services/dlp_service/pagers.py index 0bb564e2..ca5a5b31 100644 --- a/google/cloud/dlp_v2/services/dlp_service/pagers.py +++ b/google/cloud/dlp_v2/services/dlp_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.dlp_v2.types import dlp @@ -24,7 +33,7 @@ class ListInspectTemplatesPager: """A pager for iterating through ``list_inspect_templates`` requests. This class thinly wraps an initial - :class:`~.dlp.ListInspectTemplatesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListInspectTemplatesResponse` object, and provides an ``__iter__`` method to iterate through its ``inspect_templates`` field. @@ -33,7 +42,7 @@ class ListInspectTemplatesPager: through the ``inspect_templates`` field on the corresponding responses. - All the usual :class:`~.dlp.ListInspectTemplatesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListInspectTemplatesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +60,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListInspectTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListInspectTemplatesRequest): The initial request object. - response (:class:`~.dlp.ListInspectTemplatesResponse`): + response (google.cloud.dlp_v2.types.ListInspectTemplatesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +95,7 @@ class ListInspectTemplatesAsyncPager: """A pager for iterating through ``list_inspect_templates`` requests. This class thinly wraps an initial - :class:`~.dlp.ListInspectTemplatesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListInspectTemplatesResponse` object, and provides an ``__aiter__`` method to iterate through its ``inspect_templates`` field. @@ -95,7 +104,7 @@ class ListInspectTemplatesAsyncPager: through the ``inspect_templates`` field on the corresponding responses. - All the usual :class:`~.dlp.ListInspectTemplatesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListInspectTemplatesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -113,9 +122,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListInspectTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListInspectTemplatesRequest): The initial request object. - response (:class:`~.dlp.ListInspectTemplatesResponse`): + response (google.cloud.dlp_v2.types.ListInspectTemplatesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -152,7 +161,7 @@ class ListDeidentifyTemplatesPager: """A pager for iterating through ``list_deidentify_templates`` requests. This class thinly wraps an initial - :class:`~.dlp.ListDeidentifyTemplatesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse` object, and provides an ``__iter__`` method to iterate through its ``deidentify_templates`` field. @@ -161,7 +170,7 @@ class ListDeidentifyTemplatesPager: through the ``deidentify_templates`` field on the corresponding responses. - All the usual :class:`~.dlp.ListDeidentifyTemplatesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -179,9 +188,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListDeidentifyTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest): The initial request object. - response (:class:`~.dlp.ListDeidentifyTemplatesResponse`): + response (google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -214,7 +223,7 @@ class ListDeidentifyTemplatesAsyncPager: """A pager for iterating through ``list_deidentify_templates`` requests. This class thinly wraps an initial - :class:`~.dlp.ListDeidentifyTemplatesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse` object, and provides an ``__aiter__`` method to iterate through its ``deidentify_templates`` field. @@ -223,7 +232,7 @@ class ListDeidentifyTemplatesAsyncPager: through the ``deidentify_templates`` field on the corresponding responses. - All the usual :class:`~.dlp.ListDeidentifyTemplatesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -241,9 +250,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListDeidentifyTemplatesRequest`): + request (google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest): The initial request object. - response (:class:`~.dlp.ListDeidentifyTemplatesResponse`): + response (google.cloud.dlp_v2.types.ListDeidentifyTemplatesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -280,7 +289,7 @@ class ListJobTriggersPager: """A pager for iterating through ``list_job_triggers`` requests. This class thinly wraps an initial - :class:`~.dlp.ListJobTriggersResponse` object, and + :class:`google.cloud.dlp_v2.types.ListJobTriggersResponse` object, and provides an ``__iter__`` method to iterate through its ``job_triggers`` field. @@ -289,7 +298,7 @@ class ListJobTriggersPager: through the ``job_triggers`` field on the corresponding responses. - All the usual :class:`~.dlp.ListJobTriggersResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListJobTriggersResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -307,9 +316,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListJobTriggersRequest`): + request (google.cloud.dlp_v2.types.ListJobTriggersRequest): The initial request object. - response (:class:`~.dlp.ListJobTriggersResponse`): + response (google.cloud.dlp_v2.types.ListJobTriggersResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -342,7 +351,7 @@ class ListJobTriggersAsyncPager: """A pager for iterating through ``list_job_triggers`` requests. This class thinly wraps an initial - :class:`~.dlp.ListJobTriggersResponse` object, and + :class:`google.cloud.dlp_v2.types.ListJobTriggersResponse` object, and provides an ``__aiter__`` method to iterate through its ``job_triggers`` field. @@ -351,7 +360,7 @@ class ListJobTriggersAsyncPager: through the ``job_triggers`` field on the corresponding responses. - All the usual :class:`~.dlp.ListJobTriggersResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListJobTriggersResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -369,9 +378,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListJobTriggersRequest`): + request (google.cloud.dlp_v2.types.ListJobTriggersRequest): The initial request object. - response (:class:`~.dlp.ListJobTriggersResponse`): + response (google.cloud.dlp_v2.types.ListJobTriggersResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -408,7 +417,7 @@ class ListDlpJobsPager: """A pager for iterating through ``list_dlp_jobs`` requests. This class thinly wraps an initial - :class:`~.dlp.ListDlpJobsResponse` object, and + :class:`google.cloud.dlp_v2.types.ListDlpJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -417,7 +426,7 @@ class ListDlpJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.dlp.ListDlpJobsResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListDlpJobsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -435,9 +444,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListDlpJobsRequest`): + request (google.cloud.dlp_v2.types.ListDlpJobsRequest): The initial request object. - response (:class:`~.dlp.ListDlpJobsResponse`): + response (google.cloud.dlp_v2.types.ListDlpJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -470,7 +479,7 @@ class ListDlpJobsAsyncPager: """A pager for iterating through ``list_dlp_jobs`` requests. This class thinly wraps an initial - :class:`~.dlp.ListDlpJobsResponse` object, and + :class:`google.cloud.dlp_v2.types.ListDlpJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -479,7 +488,7 @@ class ListDlpJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.dlp.ListDlpJobsResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListDlpJobsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -497,9 +506,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListDlpJobsRequest`): + request (google.cloud.dlp_v2.types.ListDlpJobsRequest): The initial request object. - response (:class:`~.dlp.ListDlpJobsResponse`): + response (google.cloud.dlp_v2.types.ListDlpJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -536,7 +545,7 @@ class ListStoredInfoTypesPager: """A pager for iterating through ``list_stored_info_types`` requests. This class thinly wraps an initial - :class:`~.dlp.ListStoredInfoTypesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListStoredInfoTypesResponse` object, and provides an ``__iter__`` method to iterate through its ``stored_info_types`` field. @@ -545,7 +554,7 @@ class ListStoredInfoTypesPager: through the ``stored_info_types`` field on the corresponding responses. - All the usual :class:`~.dlp.ListStoredInfoTypesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListStoredInfoTypesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -563,9 +572,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListStoredInfoTypesRequest`): + request (google.cloud.dlp_v2.types.ListStoredInfoTypesRequest): The initial request object. - response (:class:`~.dlp.ListStoredInfoTypesResponse`): + response (google.cloud.dlp_v2.types.ListStoredInfoTypesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -598,7 +607,7 @@ class ListStoredInfoTypesAsyncPager: """A pager for iterating through ``list_stored_info_types`` requests. This class thinly wraps an initial - :class:`~.dlp.ListStoredInfoTypesResponse` object, and + :class:`google.cloud.dlp_v2.types.ListStoredInfoTypesResponse` object, and provides an ``__aiter__`` method to iterate through its ``stored_info_types`` field. @@ -607,7 +616,7 @@ class ListStoredInfoTypesAsyncPager: through the ``stored_info_types`` field on the corresponding responses. - All the usual :class:`~.dlp.ListStoredInfoTypesResponse` + All the usual :class:`google.cloud.dlp_v2.types.ListStoredInfoTypesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -625,9 +634,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.dlp.ListStoredInfoTypesRequest`): + request (google.cloud.dlp_v2.types.ListStoredInfoTypesRequest): The initial request object. - response (:class:`~.dlp.ListStoredInfoTypesResponse`): + response (google.cloud.dlp_v2.types.ListStoredInfoTypesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/base.py b/google/cloud/dlp_v2/services/dlp_service/transports/base.py index aff4d1e5..e90ae69b 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/base.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/base.py @@ -68,10 +68,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -79,6 +79,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -88,20 +91,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._scopes, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -114,6 +114,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -127,6 +128,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -140,6 +142,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -153,6 +156,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -166,6 +170,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -189,6 +194,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -202,6 +208,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -215,6 +222,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -238,6 +246,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -251,6 +260,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -264,6 +274,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -288,6 +299,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -301,6 +313,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -314,6 +327,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -335,6 +349,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -348,6 +363,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -361,6 +377,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -387,6 +404,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -400,6 +418,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, @@ -413,6 +432,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=300.0, ), default_timeout=300.0, client_info=client_info, diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/grpc.py b/google/cloud/dlp_v2/services/dlp_service/transports/grpc.py index f7ed34a4..a6fd0c7a 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/grpc.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/grpc.py @@ -66,6 +66,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -96,6 +97,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -110,72 +115,60 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -183,17 +176,8 @@ def __init__( ], ) - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -207,7 +191,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py b/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py index 41654b8a..ff938c48 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py @@ -70,7 +70,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If @@ -110,6 +110,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -141,12 +142,16 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing your own client library. Raises: @@ -155,72 +160,60 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -228,17 +221,8 @@ def __init__( ], ) - # Run the base constructor. - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/dlp_v2/types/__init__.py b/google/cloud/dlp_v2/types/__init__.py index 5e17edb4..8070ff45 100644 --- a/google/cloud/dlp_v2/types/__init__.py +++ b/google/cloud/dlp_v2/types/__init__.py @@ -15,320 +15,320 @@ # limitations under the License. # -from .storage import ( - InfoType, - StoredType, - CustomInfoType, - FieldId, - PartitionId, - KindExpression, - DatastoreOptions, - CloudStorageRegexFileSet, - CloudStorageOptions, - CloudStorageFileSet, - CloudStoragePath, - BigQueryOptions, - StorageConfig, - HybridOptions, - BigQueryKey, - DatastoreKey, - Key, - RecordKey, - BigQueryTable, - BigQueryField, - EntityId, - TableOptions, - Likelihood, - FileType, -) from .dlp import ( + Action, + ActivateJobTriggerRequest, + AnalyzeDataSourceRiskDetails, + BoundingBox, + BucketingConfig, + ByteContentItem, + CancelDlpJobRequest, + CharacterMaskConfig, + CharsToIgnore, + Color, + Container, + ContentItem, + ContentLocation, + CreateDeidentifyTemplateRequest, + CreateDlpJobRequest, + CreateInspectTemplateRequest, + CreateJobTriggerRequest, + CreateStoredInfoTypeRequest, + CryptoDeterministicConfig, + CryptoHashConfig, + CryptoKey, + CryptoReplaceFfxFpeConfig, + DateShiftConfig, + DateTime, + DeidentifyConfig, + DeidentifyContentRequest, + DeidentifyContentResponse, + DeidentifyTemplate, + DeleteDeidentifyTemplateRequest, + DeleteDlpJobRequest, + DeleteInspectTemplateRequest, + DeleteJobTriggerRequest, + DeleteStoredInfoTypeRequest, + DlpJob, + DocumentLocation, + Error, ExcludeInfoTypes, ExclusionRule, + FieldTransformation, + Finding, + FinishDlpJobRequest, + FixedSizeBucketingConfig, + GetDeidentifyTemplateRequest, + GetDlpJobRequest, + GetInspectTemplateRequest, + GetJobTriggerRequest, + GetStoredInfoTypeRequest, + HybridContentItem, + HybridFindingDetails, + HybridInspectDlpJobRequest, + HybridInspectJobTriggerRequest, + HybridInspectResponse, + HybridInspectStatistics, + ImageLocation, + InfoTypeDescription, + InfoTypeStats, + InfoTypeTransformations, + InspectConfig, + InspectContentRequest, + InspectContentResponse, + InspectDataSourceDetails, InspectionRule, InspectionRuleSet, - InspectConfig, - ByteContentItem, - ContentItem, - Table, + InspectJobConfig, InspectResult, - Finding, + InspectTemplate, + JobTrigger, + KmsWrappedCryptoKey, + LargeCustomDictionaryConfig, + LargeCustomDictionaryStats, + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + ListDlpJobsRequest, + ListDlpJobsResponse, + ListInfoTypesRequest, + ListInfoTypesResponse, + ListInspectTemplatesRequest, + ListInspectTemplatesResponse, + ListJobTriggersRequest, + ListJobTriggersResponse, + ListStoredInfoTypesRequest, + ListStoredInfoTypesResponse, Location, - ContentLocation, + Manual, MetadataLocation, - StorageMetadataLabel, - DocumentLocation, - RecordLocation, - TableLocation, - Container, + OutputStorageConfig, + PrimitiveTransformation, + PrivacyMetric, + QuasiId, + QuoteInfo, Range, - ImageLocation, - BoundingBox, + RecordCondition, + RecordLocation, + RecordSuppression, + RecordTransformations, + RedactConfig, RedactImageRequest, - Color, RedactImageResponse, - DeidentifyContentRequest, - DeidentifyContentResponse, ReidentifyContentRequest, ReidentifyContentResponse, - InspectContentRequest, - InspectContentResponse, - OutputStorageConfig, - InfoTypeStats, - InspectDataSourceDetails, - HybridInspectStatistics, - InfoTypeDescription, - ListInfoTypesRequest, - ListInfoTypesResponse, + ReplaceValueConfig, + ReplaceWithInfoTypeConfig, RiskAnalysisJobConfig, - QuasiId, + Schedule, StatisticalTable, - PrivacyMetric, - AnalyzeDataSourceRiskDetails, - ValueFrequency, - Value, - QuoteInfo, - DateTime, - DeidentifyConfig, - TransformationErrorHandling, - PrimitiveTransformation, + StorageMetadataLabel, + StoredInfoType, + StoredInfoTypeConfig, + StoredInfoTypeStats, + StoredInfoTypeVersion, + Table, + TableLocation, TimePartConfig, - CryptoHashConfig, - CryptoDeterministicConfig, - ReplaceValueConfig, - ReplaceWithInfoTypeConfig, - RedactConfig, - CharsToIgnore, - CharacterMaskConfig, - FixedSizeBucketingConfig, - BucketingConfig, - CryptoReplaceFfxFpeConfig, - CryptoKey, - TransientCryptoKey, - UnwrappedCryptoKey, - KmsWrappedCryptoKey, - DateShiftConfig, - InfoTypeTransformations, - FieldTransformation, - RecordTransformations, - RecordSuppression, - RecordCondition, + TransformationErrorHandling, TransformationOverview, TransformationSummary, - Schedule, - Manual, - InspectTemplate, - DeidentifyTemplate, - Error, - JobTrigger, - Action, - CreateInspectTemplateRequest, + TransientCryptoKey, + UnwrappedCryptoKey, + UpdateDeidentifyTemplateRequest, UpdateInspectTemplateRequest, - GetInspectTemplateRequest, - ListInspectTemplatesRequest, - ListInspectTemplatesResponse, - DeleteInspectTemplateRequest, - CreateJobTriggerRequest, - ActivateJobTriggerRequest, UpdateJobTriggerRequest, - GetJobTriggerRequest, - CreateDlpJobRequest, - ListJobTriggersRequest, - ListJobTriggersResponse, - DeleteJobTriggerRequest, - InspectJobConfig, - DlpJob, - GetDlpJobRequest, - ListDlpJobsRequest, - ListDlpJobsResponse, - CancelDlpJobRequest, - FinishDlpJobRequest, - DeleteDlpJobRequest, - CreateDeidentifyTemplateRequest, - UpdateDeidentifyTemplateRequest, - GetDeidentifyTemplateRequest, - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - DeleteDeidentifyTemplateRequest, - LargeCustomDictionaryConfig, - LargeCustomDictionaryStats, - StoredInfoTypeConfig, - StoredInfoTypeStats, - StoredInfoTypeVersion, - StoredInfoType, - CreateStoredInfoTypeRequest, UpdateStoredInfoTypeRequest, - GetStoredInfoTypeRequest, - ListStoredInfoTypesRequest, - ListStoredInfoTypesResponse, - DeleteStoredInfoTypeRequest, - HybridInspectJobTriggerRequest, - HybridInspectDlpJobRequest, - HybridContentItem, - HybridFindingDetails, - HybridInspectResponse, - RelationalOperator, - MatchingType, + Value, + ValueFrequency, ContentOption, - MetadataType, - InfoTypeSupportedBy, DlpJobType, + InfoTypeSupportedBy, + MatchingType, + MetadataType, + RelationalOperator, StoredInfoTypeState, ) - -__all__ = ( - "InfoType", - "StoredType", - "CustomInfoType", - "FieldId", - "PartitionId", - "KindExpression", - "DatastoreOptions", - "CloudStorageRegexFileSet", - "CloudStorageOptions", - "CloudStorageFileSet", - "CloudStoragePath", - "BigQueryOptions", - "StorageConfig", - "HybridOptions", - "BigQueryKey", - "DatastoreKey", - "Key", - "RecordKey", - "BigQueryTable", - "BigQueryField", - "EntityId", - "TableOptions", - "Likelihood", - "FileType", +from .storage import ( + BigQueryField, + BigQueryKey, + BigQueryOptions, + BigQueryTable, + CloudStorageFileSet, + CloudStorageOptions, + CloudStoragePath, + CloudStorageRegexFileSet, + CustomInfoType, + DatastoreKey, + DatastoreOptions, + EntityId, + FieldId, + HybridOptions, + InfoType, + Key, + KindExpression, + PartitionId, + RecordKey, + StorageConfig, + StoredType, + TableOptions, + FileType, + Likelihood, +) + +__all__ = ( + "Action", + "ActivateJobTriggerRequest", + "AnalyzeDataSourceRiskDetails", + "BoundingBox", + "BucketingConfig", + "ByteContentItem", + "CancelDlpJobRequest", + "CharacterMaskConfig", + "CharsToIgnore", + "Color", + "Container", + "ContentItem", + "ContentLocation", + "CreateDeidentifyTemplateRequest", + "CreateDlpJobRequest", + "CreateInspectTemplateRequest", + "CreateJobTriggerRequest", + "CreateStoredInfoTypeRequest", + "CryptoDeterministicConfig", + "CryptoHashConfig", + "CryptoKey", + "CryptoReplaceFfxFpeConfig", + "DateShiftConfig", + "DateTime", + "DeidentifyConfig", + "DeidentifyContentRequest", + "DeidentifyContentResponse", + "DeidentifyTemplate", + "DeleteDeidentifyTemplateRequest", + "DeleteDlpJobRequest", + "DeleteInspectTemplateRequest", + "DeleteJobTriggerRequest", + "DeleteStoredInfoTypeRequest", + "DlpJob", + "DocumentLocation", + "Error", "ExcludeInfoTypes", "ExclusionRule", + "FieldTransformation", + "Finding", + "FinishDlpJobRequest", + "FixedSizeBucketingConfig", + "GetDeidentifyTemplateRequest", + "GetDlpJobRequest", + "GetInspectTemplateRequest", + "GetJobTriggerRequest", + "GetStoredInfoTypeRequest", + "HybridContentItem", + "HybridFindingDetails", + "HybridInspectDlpJobRequest", + "HybridInspectJobTriggerRequest", + "HybridInspectResponse", + "HybridInspectStatistics", + "ImageLocation", + "InfoTypeDescription", + "InfoTypeStats", + "InfoTypeTransformations", + "InspectConfig", + "InspectContentRequest", + "InspectContentResponse", + "InspectDataSourceDetails", "InspectionRule", "InspectionRuleSet", - "InspectConfig", - "ByteContentItem", - "ContentItem", - "Table", + "InspectJobConfig", "InspectResult", - "Finding", + "InspectTemplate", + "JobTrigger", + "KmsWrappedCryptoKey", + "LargeCustomDictionaryConfig", + "LargeCustomDictionaryStats", + "ListDeidentifyTemplatesRequest", + "ListDeidentifyTemplatesResponse", + "ListDlpJobsRequest", + "ListDlpJobsResponse", + "ListInfoTypesRequest", + "ListInfoTypesResponse", + "ListInspectTemplatesRequest", + "ListInspectTemplatesResponse", + "ListJobTriggersRequest", + "ListJobTriggersResponse", + "ListStoredInfoTypesRequest", + "ListStoredInfoTypesResponse", "Location", - "ContentLocation", + "Manual", "MetadataLocation", - "StorageMetadataLabel", - "DocumentLocation", - "RecordLocation", - "TableLocation", - "Container", + "OutputStorageConfig", + "PrimitiveTransformation", + "PrivacyMetric", + "QuasiId", + "QuoteInfo", "Range", - "ImageLocation", - "BoundingBox", + "RecordCondition", + "RecordLocation", + "RecordSuppression", + "RecordTransformations", + "RedactConfig", "RedactImageRequest", - "Color", "RedactImageResponse", - "DeidentifyContentRequest", - "DeidentifyContentResponse", "ReidentifyContentRequest", "ReidentifyContentResponse", - "InspectContentRequest", - "InspectContentResponse", - "OutputStorageConfig", - "InfoTypeStats", - "InspectDataSourceDetails", - "HybridInspectStatistics", - "InfoTypeDescription", - "ListInfoTypesRequest", - "ListInfoTypesResponse", + "ReplaceValueConfig", + "ReplaceWithInfoTypeConfig", "RiskAnalysisJobConfig", - "QuasiId", + "Schedule", "StatisticalTable", - "PrivacyMetric", - "AnalyzeDataSourceRiskDetails", - "ValueFrequency", - "Value", - "QuoteInfo", - "DateTime", - "DeidentifyConfig", - "TransformationErrorHandling", - "PrimitiveTransformation", + "StorageMetadataLabel", + "StoredInfoType", + "StoredInfoTypeConfig", + "StoredInfoTypeStats", + "StoredInfoTypeVersion", + "Table", + "TableLocation", "TimePartConfig", - "CryptoHashConfig", - "CryptoDeterministicConfig", - "ReplaceValueConfig", - "ReplaceWithInfoTypeConfig", - "RedactConfig", - "CharsToIgnore", - "CharacterMaskConfig", - "FixedSizeBucketingConfig", - "BucketingConfig", - "CryptoReplaceFfxFpeConfig", - "CryptoKey", - "TransientCryptoKey", - "UnwrappedCryptoKey", - "KmsWrappedCryptoKey", - "DateShiftConfig", - "InfoTypeTransformations", - "FieldTransformation", - "RecordTransformations", - "RecordSuppression", - "RecordCondition", + "TransformationErrorHandling", "TransformationOverview", "TransformationSummary", - "Schedule", - "Manual", - "InspectTemplate", - "DeidentifyTemplate", - "Error", - "JobTrigger", - "Action", - "CreateInspectTemplateRequest", + "TransientCryptoKey", + "UnwrappedCryptoKey", + "UpdateDeidentifyTemplateRequest", "UpdateInspectTemplateRequest", - "GetInspectTemplateRequest", - "ListInspectTemplatesRequest", - "ListInspectTemplatesResponse", - "DeleteInspectTemplateRequest", - "CreateJobTriggerRequest", - "ActivateJobTriggerRequest", "UpdateJobTriggerRequest", - "GetJobTriggerRequest", - "CreateDlpJobRequest", - "ListJobTriggersRequest", - "ListJobTriggersResponse", - "DeleteJobTriggerRequest", - "InspectJobConfig", - "DlpJob", - "GetDlpJobRequest", - "ListDlpJobsRequest", - "ListDlpJobsResponse", - "CancelDlpJobRequest", - "FinishDlpJobRequest", - "DeleteDlpJobRequest", - "CreateDeidentifyTemplateRequest", - "UpdateDeidentifyTemplateRequest", - "GetDeidentifyTemplateRequest", - "ListDeidentifyTemplatesRequest", - "ListDeidentifyTemplatesResponse", - "DeleteDeidentifyTemplateRequest", - "LargeCustomDictionaryConfig", - "LargeCustomDictionaryStats", - "StoredInfoTypeConfig", - "StoredInfoTypeStats", - "StoredInfoTypeVersion", - "StoredInfoType", - "CreateStoredInfoTypeRequest", "UpdateStoredInfoTypeRequest", - "GetStoredInfoTypeRequest", - "ListStoredInfoTypesRequest", - "ListStoredInfoTypesResponse", - "DeleteStoredInfoTypeRequest", - "HybridInspectJobTriggerRequest", - "HybridInspectDlpJobRequest", - "HybridContentItem", - "HybridFindingDetails", - "HybridInspectResponse", - "RelationalOperator", - "MatchingType", + "Value", + "ValueFrequency", "ContentOption", - "MetadataType", - "InfoTypeSupportedBy", "DlpJobType", + "InfoTypeSupportedBy", + "MatchingType", + "MetadataType", + "RelationalOperator", "StoredInfoTypeState", + "BigQueryField", + "BigQueryKey", + "BigQueryOptions", + "BigQueryTable", + "CloudStorageFileSet", + "CloudStorageOptions", + "CloudStoragePath", + "CloudStorageRegexFileSet", + "CustomInfoType", + "DatastoreKey", + "DatastoreOptions", + "EntityId", + "FieldId", + "HybridOptions", + "InfoType", + "Key", + "KindExpression", + "PartitionId", + "RecordKey", + "StorageConfig", + "StoredType", + "TableOptions", + "FileType", + "Likelihood", ) diff --git a/google/cloud/dlp_v2/types/dlp.py b/google/cloud/dlp_v2/types/dlp.py index 69fec852..921bc60c 100644 --- a/google/cloud/dlp_v2/types/dlp.py +++ b/google/cloud/dlp_v2/types/dlp.py @@ -232,7 +232,7 @@ class ExcludeInfoTypes(proto.Message): r"""List of exclude infoTypes. Attributes: - info_types (Sequence[~.storage.InfoType]): + info_types (Sequence[google.cloud.dlp_v2.types.InfoType]): InfoType list in ExclusionRule rule drops a finding when it overlaps or contained within with a finding of an infoType from this list. For example, for @@ -252,14 +252,14 @@ class ExclusionRule(proto.Message): specified in ``InspectionRuleSet`` are removed from results. Attributes: - dictionary (~.storage.CustomInfoType.Dictionary): + dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): Dictionary which defines the rule. - regex (~.storage.CustomInfoType.Regex): + regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Regular expression which defines the rule. - exclude_info_types (~.dlp.ExcludeInfoTypes): + exclude_info_types (google.cloud.dlp_v2.types.ExcludeInfoTypes): Set of infoTypes for which findings would affect this rule. - matching_type (~.dlp.MatchingType): + matching_type (google.cloud.dlp_v2.types.MatchingType): How the rule is applied, see MatchingType documentation for details. """ @@ -287,9 +287,9 @@ class InspectionRule(proto.Message): ``InspectionRuleSet``. Attributes: - hotword_rule (~.storage.CustomInfoType.DetectionRule.HotwordRule): + hotword_rule (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.HotwordRule): Hotword-based detection rule. - exclusion_rule (~.dlp.ExclusionRule): + exclusion_rule (google.cloud.dlp_v2.types.ExclusionRule): Exclusion rule. """ @@ -311,10 +311,10 @@ class InspectionRuleSet(proto.Message): of the rules within the set. Attributes: - info_types (Sequence[~.storage.InfoType]): + info_types (Sequence[google.cloud.dlp_v2.types.InfoType]): List of infoTypes this rule set is applied to. - rules (Sequence[~.dlp.InspectionRule]): + rules (Sequence[google.cloud.dlp_v2.types.InspectionRule]): Set of rules to be applied to infoTypes. The rules are applied in order. """ @@ -329,7 +329,7 @@ class InspectConfig(proto.Message): redactContent only info_types and min_likelihood are currently used. Attributes: - info_types (Sequence[~.storage.InfoType]): + info_types (Sequence[google.cloud.dlp_v2.types.InfoType]): Restricts what info_types to look for. The values must correspond to InfoType values returned by ListInfoTypes or listed at @@ -344,12 +344,12 @@ class InspectConfig(proto.Message): detectors are run you should specify specific InfoTypes listed in the reference, otherwise a default list will be used, which may change over time. - min_likelihood (~.storage.Likelihood): + min_likelihood (google.cloud.dlp_v2.types.Likelihood): Only returns findings equal or above this threshold. The default is POSSIBLE. See https://cloud.google.com/dlp/docs/likelihood to learn more. - limits (~.dlp.InspectConfig.FindingLimits): + limits (google.cloud.dlp_v2.types.InspectConfig.FindingLimits): Configuration to control the number of findings returned. include_quote (bool): @@ -359,15 +359,15 @@ class InspectConfig(proto.Message): exclude_info_types (bool): When true, excludes type information of the findings. - custom_info_types (Sequence[~.storage.CustomInfoType]): + custom_info_types (Sequence[google.cloud.dlp_v2.types.CustomInfoType]): CustomInfoTypes provided by the user. See https://cloud.google.com/dlp/docs/creating- custom-infotypes to learn more. - content_options (Sequence[~.dlp.ContentOption]): + content_options (Sequence[google.cloud.dlp_v2.types.ContentOption]): List of options defining data content to scan. If empty, text, images, and other content will be included. - rule_set (Sequence[~.dlp.InspectionRuleSet]): + rule_set (Sequence[google.cloud.dlp_v2.types.InspectionRuleSet]): Set of rules to apply to the findings for this InspectConfig. Exclusion rules, contained in the set are executed in the end, other rules @@ -388,7 +388,7 @@ class FindingLimits(proto.Message): Max number of findings that will be returned per request/job. When set within ``InspectContentRequest``, the maximum returned is 2000 regardless if this is set higher. - max_findings_per_info_type (Sequence[~.dlp.InspectConfig.FindingLimits.InfoTypeLimit]): + max_findings_per_info_type (Sequence[google.cloud.dlp_v2.types.InspectConfig.FindingLimits.InfoTypeLimit]): Configuration of findings limit given for specified infoTypes. """ @@ -398,7 +398,7 @@ class InfoTypeLimit(proto.Message): long running DlpJob. Attributes: - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): Type of information the findings limit applies to. Only one limit per info_type should be provided. If InfoTypeLimit does not have an info_type, the DLP API applies the limit @@ -447,7 +447,7 @@ class ByteContentItem(proto.Message): r"""Container for bytes to inspect or redact. Attributes: - type_ (~.dlp.ByteContentItem.BytesType): + type_ (google.cloud.dlp_v2.types.ByteContentItem.BytesType): The type of data stored in the bytes string. Default will be TEXT_UTF8. data (bytes): @@ -480,11 +480,11 @@ class ContentItem(proto.Message): Attributes: value (str): String data to inspect or redact. - table (~.dlp.Table): + table (google.cloud.dlp_v2.types.Table): Structured content for inspection. See https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to learn more. - byte_item (~.dlp.ByteContentItem): + byte_item (google.cloud.dlp_v2.types.ByteContentItem): Content data to inspect or redact. Replaces ``type`` and ``data``. """ @@ -505,9 +505,9 @@ class Table(proto.Message): to learn more. Attributes: - headers (Sequence[~.storage.FieldId]): + headers (Sequence[google.cloud.dlp_v2.types.FieldId]): Headers of the table. - rows (Sequence[~.dlp.Table.Row]): + rows (Sequence[google.cloud.dlp_v2.types.Table.Row]): Rows of the table. """ @@ -515,7 +515,7 @@ class Row(proto.Message): r"""Values of the row. Attributes: - values (Sequence[~.dlp.Value]): + values (Sequence[google.cloud.dlp_v2.types.Value]): Individual cells. """ @@ -530,7 +530,7 @@ class InspectResult(proto.Message): r"""All the findings for a single scanned item. Attributes: - findings (Sequence[~.dlp.Finding]): + findings (Sequence[google.cloud.dlp_v2.types.Finding]): List of findings for an item. findings_truncated (bool): If true, then this item might have more @@ -563,17 +563,17 @@ class Finding(proto.Message): here. Provided if ``include_quote`` is true and the finding is less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes in length, the quote may be omitted. - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): The type of content that might have been found. Provided if ``excluded_types`` is false. - likelihood (~.storage.Likelihood): + likelihood (google.cloud.dlp_v2.types.Likelihood): Confidence of how likely it is that the ``info_type`` is correct. - location (~.dlp.Location): + location (google.cloud.dlp_v2.types.Location): Where the content was found. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp when finding was detected. - quote_info (~.dlp.QuoteInfo): + quote_info (google.cloud.dlp_v2.types.QuoteInfo): Contains data parsed from quotes. Only populated if include_quote was set to true and a supported infoType was requested. Currently supported infoTypes: DATE, @@ -583,7 +583,7 @@ class Finding(proto.Message): trigger_name (str): Job trigger name, if applicable, for this finding. - labels (Sequence[~.dlp.Finding.LabelsEntry]): + labels (Sequence[google.cloud.dlp_v2.types.Finding.LabelsEntry]): The labels associated with this ``Finding``. Label keys must be between 1 and 63 characters long and must @@ -601,7 +601,7 @@ class Finding(proto.Message): - ``"environment" : "production"`` - ``"pipeline" : "etl"`` - job_create_time (~.timestamp.Timestamp): + job_create_time (google.protobuf.timestamp_pb2.Timestamp): Time the job started that produced this finding. job_name (str): @@ -639,23 +639,23 @@ class Location(proto.Message): r"""Specifies the location of the finding. Attributes: - byte_range (~.dlp.Range): + byte_range (google.cloud.dlp_v2.types.Range): Zero-based byte offsets delimiting the finding. These are relative to the finding's containing element. Note that when the content is not textual, this references the UTF-8 encoded textual representation of the content. Omitted if content is an image. - codepoint_range (~.dlp.Range): + codepoint_range (google.cloud.dlp_v2.types.Range): Unicode character offsets delimiting the finding. These are relative to the finding's containing element. Provided when the content is text. - content_locations (Sequence[~.dlp.ContentLocation]): + content_locations (Sequence[google.cloud.dlp_v2.types.ContentLocation]): List of nested objects pointing to the precise location of the finding within the file or record. - container (~.dlp.Container): + container (google.cloud.dlp_v2.types.Container): Information about the container where this finding occurred, if available. """ @@ -688,17 +688,17 @@ class ContentLocation(proto.Message): Nested names could be absent if the embedded object has no string identifier (for an example an image contained within a document). - record_location (~.dlp.RecordLocation): + record_location (google.cloud.dlp_v2.types.RecordLocation): Location within a row or record of a database table. - image_location (~.dlp.ImageLocation): + image_location (google.cloud.dlp_v2.types.ImageLocation): Location within an image's pixels. - document_location (~.dlp.DocumentLocation): + document_location (google.cloud.dlp_v2.types.DocumentLocation): Location data for document files. - metadata_location (~.dlp.MetadataLocation): + metadata_location (google.cloud.dlp_v2.types.MetadataLocation): Location within the metadata for inspected content. - container_timestamp (~.timestamp.Timestamp): + container_timestamp (google.protobuf.timestamp_pb2.Timestamp): Findings container modification timestamp, if applicable. For Google Cloud Storage contains last file modification timestamp. For BigQuery table contains last_modified_time @@ -737,9 +737,9 @@ class MetadataLocation(proto.Message): r"""Metadata Location Attributes: - type_ (~.dlp.MetadataType): + type_ (google.cloud.dlp_v2.types.MetadataType): Type of metadata containing the finding. - storage_label (~.dlp.StorageMetadataLabel): + storage_label (google.cloud.dlp_v2.types.StorageMetadataLabel): Storage metadata. """ @@ -778,11 +778,11 @@ class RecordLocation(proto.Message): r"""Location of a finding within a row or record. Attributes: - record_key (~.storage.RecordKey): + record_key (google.cloud.dlp_v2.types.RecordKey): Key of the finding. - field_id (~.storage.FieldId): + field_id (google.cloud.dlp_v2.types.FieldId): Field id of the field containing the finding. - table_location (~.dlp.TableLocation): + table_location (google.cloud.dlp_v2.types.TableLocation): Location within a ``ContentItem.Table``. """ @@ -845,7 +845,7 @@ class Container(proto.Message): - Google Cloud Storage file ``gs://bucket/folder/filename.txt``, the relative path is ``folder/filename.txt`` - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Findings container modification timestamp, if applicable. For Google Cloud Storage contains last file modification timestamp. For BigQuery table contains last_modified_time @@ -891,7 +891,7 @@ class ImageLocation(proto.Message): r"""Location of the finding within an image. Attributes: - bounding_boxes (Sequence[~.dlp.BoundingBox]): + bounding_boxes (Sequence[google.cloud.dlp_v2.types.BoundingBox]): Bounding boxes locating the pixels within the image containing the finding. """ @@ -952,15 +952,15 @@ class RedactImageRequest(proto.Message): parent=projects/example-project/locations/europe-west3 location_id (str): Deprecated. This field has no effect. - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): Configuration for the inspector. - image_redaction_configs (Sequence[~.dlp.RedactImageRequest.ImageRedactionConfig]): + image_redaction_configs (Sequence[google.cloud.dlp_v2.types.RedactImageRequest.ImageRedactionConfig]): The configuration for specifying what content to redact from images. include_findings (bool): Whether the response should include findings along with the redacted image. - byte_item (~.dlp.ByteContentItem): + byte_item (google.cloud.dlp_v2.types.ByteContentItem): The content must be PNG, JPEG, SVG or BMP. """ @@ -969,7 +969,7 @@ class ImageRedactionConfig(proto.Message): occur. Attributes: - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): Only one per info_type should be provided per request. If not specified, and redact_all_text is false, the DLP API will redact all text that it matches against all info_types @@ -979,7 +979,7 @@ class ImageRedactionConfig(proto.Message): If true, all text found in the image, regardless whether it matches an info_type, is redacted. Only one should be provided. - redaction_color (~.dlp.Color): + redaction_color (google.cloud.dlp_v2.types.Color): The color to use when redacting content from an image. If not specified, the default is black. @@ -1041,7 +1041,7 @@ class RedactImageResponse(proto.Message): If an image was being inspected and the InspectConfig's include_quote was set to true, then this field will include all text, if any, that was found in the image. - inspect_result (~.dlp.InspectResult): + inspect_result (google.cloud.dlp_v2.types.InspectResult): The findings. Populated when include_findings in the request is true. """ @@ -1076,15 +1076,15 @@ class DeidentifyContentRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - deidentify_config (~.dlp.DeidentifyConfig): + deidentify_config (google.cloud.dlp_v2.types.DeidentifyConfig): Configuration for the de-identification of the content item. Items specified here will override the template referenced by the deidentify_template_name argument. - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument. - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The item to de-identify. Will be treated as text. inspect_template_name (str): @@ -1126,9 +1126,9 @@ class DeidentifyContentResponse(proto.Message): r"""Results of de-identifying a ContentItem. Attributes: - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The de-identified item. - overview (~.dlp.TransformationOverview): + overview (google.cloud.dlp_v2.types.TransformationOverview): An overview of the changes that were made on the ``item``. """ @@ -1160,7 +1160,7 @@ class ReidentifyContentRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - reidentify_config (~.dlp.DeidentifyConfig): + reidentify_config (google.cloud.dlp_v2.types.DeidentifyConfig): Configuration for the re-identification of the content item. This field shares the same proto message type that is used for de-identification, however its usage here is for the @@ -1173,9 +1173,9 @@ class ReidentifyContentRequest(proto.Message): - ``CryptoDeterministicConfig`` - ``CryptoReplaceFfxFpeConfig`` - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): Configuration for the inspector. - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The item to re-identify. Will be treated as text. inspect_template_name (str): @@ -1220,9 +1220,9 @@ class ReidentifyContentResponse(proto.Message): r"""Results of re-identifying a item. Attributes: - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The re-identified item. - overview (~.dlp.TransformationOverview): + overview (google.cloud.dlp_v2.types.TransformationOverview): An overview of the changes that were made to the ``item``. """ @@ -1255,11 +1255,11 @@ class InspectContentRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): Configuration for the inspector. What specified here will override the template referenced by the inspect_template_name argument. - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The item to inspect. inspect_template_name (str): Template to use. Any configuration directly specified in @@ -1287,7 +1287,7 @@ class InspectContentResponse(proto.Message): r"""Results of inspecting an item. Attributes: - result (~.dlp.InspectResult): + result (google.cloud.dlp_v2.types.InspectResult): The findings. """ @@ -1298,7 +1298,7 @@ class OutputStorageConfig(proto.Message): r"""Cloud repository for storing output. Attributes: - table (~.storage.BigQueryTable): + table (google.cloud.dlp_v2.types.BigQueryTable): Store findings in an existing table or a new table in an existing dataset. If table_id is not set a new one will be generated for you with the following format: @@ -1315,7 +1315,7 @@ class OutputStorageConfig(proto.Message): jobs that analyze the same table but compute a different privacy metric, or use different sets of quasi-identifiers, cannot store their results in the same table. - output_schema (~.dlp.OutputStorageConfig.OutputSchema): + output_schema (google.cloud.dlp_v2.types.OutputStorageConfig.OutputSchema): Schema used for writing the findings for Inspect jobs. This field is only used for Inspect and must be unspecified for Risk jobs. Columns are derived from the ``Finding`` object. @@ -1351,7 +1351,7 @@ class InfoTypeStats(proto.Message): r"""Statistics regarding a specific InfoType. Attributes: - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): The type of finding this stat is for. count (int): Number of findings for this infoType. @@ -1366,9 +1366,9 @@ class InspectDataSourceDetails(proto.Message): r"""The results of an inspect DataSource job. Attributes: - requested_options (~.dlp.InspectDataSourceDetails.RequestedOptions): + requested_options (google.cloud.dlp_v2.types.InspectDataSourceDetails.RequestedOptions): The configuration used for this job. - result (~.dlp.InspectDataSourceDetails.Result): + result (google.cloud.dlp_v2.types.InspectDataSourceDetails.Result): A summary of the outcome of this inspect job. """ @@ -1376,10 +1376,10 @@ class RequestedOptions(proto.Message): r"""Snapshot of the inspection configuration. Attributes: - snapshot_inspect_template (~.dlp.InspectTemplate): + snapshot_inspect_template (google.cloud.dlp_v2.types.InspectTemplate): If run with an InspectTemplate, a snapshot of its state at the time of this run. - job_config (~.dlp.InspectJobConfig): + job_config (google.cloud.dlp_v2.types.InspectJobConfig): Inspect config. """ @@ -1398,10 +1398,10 @@ class Result(proto.Message): Total size in bytes that were processed. total_estimated_bytes (int): Estimate of the number of bytes to process. - info_type_stats (Sequence[~.dlp.InfoTypeStats]): + info_type_stats (Sequence[google.cloud.dlp_v2.types.InfoTypeStats]): Statistics of how many instances of each info type were found during inspect job. - hybrid_stats (~.dlp.HybridInspectStatistics): + hybrid_stats (google.cloud.dlp_v2.types.HybridInspectStatistics): Statistics related to the processing of hybrid inspect. Early access feature is in a pre-release state and might change or have @@ -1462,7 +1462,7 @@ class InfoTypeDescription(proto.Message): Internal name of the infoType. display_name (str): Human readable form of the infoType name. - supported_by (Sequence[~.dlp.InfoTypeSupportedBy]): + supported_by (Sequence[google.cloud.dlp_v2.types.InfoTypeSupportedBy]): Which parts of the API supports this InfoType. description (str): @@ -1518,7 +1518,7 @@ class ListInfoTypesResponse(proto.Message): r"""Response to the ListInfoTypes request. Attributes: - info_types (Sequence[~.dlp.InfoTypeDescription]): + info_types (Sequence[google.cloud.dlp_v2.types.InfoTypeDescription]): Set of sensitive infoTypes. """ @@ -1533,11 +1533,11 @@ class RiskAnalysisJobConfig(proto.Message): learn more. Attributes: - privacy_metric (~.dlp.PrivacyMetric): + privacy_metric (google.cloud.dlp_v2.types.PrivacyMetric): Privacy metric to compute. - source_table (~.storage.BigQueryTable): + source_table (google.cloud.dlp_v2.types.BigQueryTable): Input dataset to compute metrics over. - actions (Sequence[~.dlp.Action]): + actions (Sequence[google.cloud.dlp_v2.types.Action]): Actions to execute at the completion of the job. Are executed in the order provided. """ @@ -1553,9 +1553,9 @@ class QuasiId(proto.Message): r"""A column with a semantic tag attached. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Required. Identifies the column. - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): A column can be tagged with a InfoType to use the relevant public dataset as a statistical model of population, if available. We currently support US ZIP codes, region codes, @@ -1567,7 +1567,7 @@ class QuasiId(proto.Message): this case, the user must indicate an auxiliary table that contains statistical information on the possible values of this column (below). - inferred (~.empty.Empty): + inferred (google.protobuf.empty_pb2.Empty): If no semantic tag is indicated, we infer the statistical model from the distribution of values in the input data @@ -1594,11 +1594,11 @@ class StatisticalTable(proto.Message): zero (and thus, the tuple is highly reidentifiable). Attributes: - table (~.storage.BigQueryTable): + table (google.cloud.dlp_v2.types.BigQueryTable): Required. Auxiliary table location. - quasi_ids (Sequence[~.dlp.StatisticalTable.QuasiIdentifierField]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.StatisticalTable.QuasiIdentifierField]): Required. Quasi-identifier columns. - relative_frequency (~.storage.FieldId): + relative_frequency (google.cloud.dlp_v2.types.FieldId): Required. The relative frequency column must contain a floating-point number between 0 and 1 (inclusive). Null values are assumed to be zero. @@ -1610,7 +1610,7 @@ class QuasiIdentifierField(proto.Message): model. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Identifies the column. custom_tag (str): A column can be tagged with a custom tag. In @@ -1636,17 +1636,17 @@ class PrivacyMetric(proto.Message): r"""Privacy metric to compute for reidentification risk analysis. Attributes: - numerical_stats_config (~.dlp.PrivacyMetric.NumericalStatsConfig): + numerical_stats_config (google.cloud.dlp_v2.types.PrivacyMetric.NumericalStatsConfig): Numerical stats - categorical_stats_config (~.dlp.PrivacyMetric.CategoricalStatsConfig): + categorical_stats_config (google.cloud.dlp_v2.types.PrivacyMetric.CategoricalStatsConfig): Categorical stats - k_anonymity_config (~.dlp.PrivacyMetric.KAnonymityConfig): + k_anonymity_config (google.cloud.dlp_v2.types.PrivacyMetric.KAnonymityConfig): K-anonymity - l_diversity_config (~.dlp.PrivacyMetric.LDiversityConfig): + l_diversity_config (google.cloud.dlp_v2.types.PrivacyMetric.LDiversityConfig): l-diversity - k_map_estimation_config (~.dlp.PrivacyMetric.KMapEstimationConfig): + k_map_estimation_config (google.cloud.dlp_v2.types.PrivacyMetric.KMapEstimationConfig): k-map - delta_presence_estimation_config (~.dlp.PrivacyMetric.DeltaPresenceEstimationConfig): + delta_presence_estimation_config (google.cloud.dlp_v2.types.PrivacyMetric.DeltaPresenceEstimationConfig): delta-presence """ @@ -1655,7 +1655,7 @@ class NumericalStatsConfig(proto.Message): min, max, and quantiles. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Field to compute numerical stats on. Supported types are integer, float, date, datetime, timestamp, time. @@ -1668,7 +1668,7 @@ class CategoricalStatsConfig(proto.Message): number of distinct values and value count distribution. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Field to compute categorical stats on. All column types are supported except for arrays and structs. However, it may be more informative to @@ -1683,7 +1683,7 @@ class KAnonymityConfig(proto.Message): risk. Attributes: - quasi_ids (Sequence[~.storage.FieldId]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.FieldId]): Set of fields to compute k-anonymity over. When multiple fields are specified, they are considered a single composite key. Structs and @@ -1691,7 +1691,7 @@ class KAnonymityConfig(proto.Message): nested fields are supported so long as they are not structs themselves or nested within a repeated field. - entity_id (~.storage.EntityId): + entity_id (google.cloud.dlp_v2.types.EntityId): Message indicating that multiple rows might be associated to a single individual. If the same entity_id is associated to multiple quasi-identifier tuples over distinct rows, we @@ -1716,13 +1716,13 @@ class LDiversityConfig(proto.Message): risk. Attributes: - quasi_ids (Sequence[~.storage.FieldId]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.FieldId]): Set of quasi-identifiers indicating how equivalence classes are defined for the l-diversity computation. When multiple fields are specified, they are considered a single composite key. - sensitive_attribute (~.storage.FieldId): + sensitive_attribute (google.cloud.dlp_v2.types.FieldId): Sensitive field for computing the l-value. """ @@ -1745,7 +1745,7 @@ class KMapEstimationConfig(proto.Message): dataset. Attributes: - quasi_ids (Sequence[~.dlp.PrivacyMetric.KMapEstimationConfig.TaggedField]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.PrivacyMetric.KMapEstimationConfig.TaggedField]): Required. Fields considered to be quasi- dentifiers. No two columns can have the same tag. @@ -1753,7 +1753,7 @@ class KMapEstimationConfig(proto.Message): ISO 3166-1 alpha-2 region code to use in the statistical modeling. Set if no column is tagged with a region-specific InfoType (like US_ZIP_5) or a region code. - auxiliary_tables (Sequence[~.dlp.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable]): + auxiliary_tables (Sequence[google.cloud.dlp_v2.types.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable]): Several auxiliary tables can be used in the analysis. Each custom_tag used to tag a quasi-identifiers column must appear in exactly one column of one auxiliary table. @@ -1763,9 +1763,9 @@ class TaggedField(proto.Message): r"""A column with a semantic tag attached. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Required. Identifies the column. - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): A column can be tagged with a InfoType to use the relevant public dataset as a statistical model of population, if available. We currently support US ZIP codes, region codes, @@ -1777,7 +1777,7 @@ class TaggedField(proto.Message): this case, the user must indicate an auxiliary table that contains statistical information on the possible values of this column (below). - inferred (~.empty.Empty): + inferred (google.protobuf.empty_pb2.Empty): If no semantic tag is indicated, we infer the statistical model from the distribution of values in the input data @@ -1805,11 +1805,11 @@ class AuxiliaryTable(proto.Message): zero (and thus, the tuple is highly reidentifiable). Attributes: - table (~.storage.BigQueryTable): + table (google.cloud.dlp_v2.types.BigQueryTable): Required. Auxiliary table location. - quasi_ids (Sequence[~.dlp.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable.QuasiIdField]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable.QuasiIdField]): Required. Quasi-identifier columns. - relative_frequency (~.storage.FieldId): + relative_frequency (google.cloud.dlp_v2.types.FieldId): Required. The relative frequency column must contain a floating-point number between 0 and 1 (inclusive). Null values are assumed to be zero. @@ -1821,7 +1821,7 @@ class QuasiIdField(proto.Message): model. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Identifies the column. custom_tag (str): A auxiliary field. @@ -1865,14 +1865,14 @@ class DeltaPresenceEstimationConfig(proto.Message): so we use a statistical model instead. Attributes: - quasi_ids (Sequence[~.dlp.QuasiId]): + quasi_ids (Sequence[google.cloud.dlp_v2.types.QuasiId]): Required. Fields considered to be quasi- dentifiers. No two fields can have the same tag. region_code (str): ISO 3166-1 alpha-2 region code to use in the statistical modeling. Set if no column is tagged with a region-specific InfoType (like US_ZIP_5) or a region code. - auxiliary_tables (Sequence[~.dlp.StatisticalTable]): + auxiliary_tables (Sequence[google.cloud.dlp_v2.types.StatisticalTable]): Several auxiliary tables can be used in the analysis. Each custom_tag used to tag a quasi-identifiers field must appear in exactly one field of one auxiliary table. @@ -1915,23 +1915,23 @@ class AnalyzeDataSourceRiskDetails(proto.Message): r"""Result of a risk analysis operation request. Attributes: - requested_privacy_metric (~.dlp.PrivacyMetric): + requested_privacy_metric (google.cloud.dlp_v2.types.PrivacyMetric): Privacy metric to compute. - requested_source_table (~.storage.BigQueryTable): + requested_source_table (google.cloud.dlp_v2.types.BigQueryTable): Input dataset to compute metrics over. - numerical_stats_result (~.dlp.AnalyzeDataSourceRiskDetails.NumericalStatsResult): + numerical_stats_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.NumericalStatsResult): Numerical stats result - categorical_stats_result (~.dlp.AnalyzeDataSourceRiskDetails.CategoricalStatsResult): + categorical_stats_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.CategoricalStatsResult): Categorical stats result - k_anonymity_result (~.dlp.AnalyzeDataSourceRiskDetails.KAnonymityResult): + k_anonymity_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KAnonymityResult): K-anonymity result - l_diversity_result (~.dlp.AnalyzeDataSourceRiskDetails.LDiversityResult): + l_diversity_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.LDiversityResult): L-divesity result - k_map_estimation_result (~.dlp.AnalyzeDataSourceRiskDetails.KMapEstimationResult): + k_map_estimation_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KMapEstimationResult): K-map result - delta_presence_estimation_result (~.dlp.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult): + delta_presence_estimation_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult): Delta-presence result - requested_options (~.dlp.AnalyzeDataSourceRiskDetails.RequestedRiskAnalysisOptions): + requested_options (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.RequestedRiskAnalysisOptions): The configuration used for this job. """ @@ -1939,11 +1939,11 @@ class NumericalStatsResult(proto.Message): r"""Result of the numerical stats computation. Attributes: - min_value (~.dlp.Value): + min_value (google.cloud.dlp_v2.types.Value): Minimum value appearing in the column. - max_value (~.dlp.Value): + max_value (google.cloud.dlp_v2.types.Value): Maximum value appearing in the column. - quantile_values (Sequence[~.dlp.Value]): + quantile_values (Sequence[google.cloud.dlp_v2.types.Value]): List of 99 values that partition the set of field values into 100 equal sized buckets. """ @@ -1958,7 +1958,7 @@ class CategoricalStatsResult(proto.Message): r"""Result of the categorical stats computation. Attributes: - value_frequency_histogram_buckets (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.CategoricalStatsResult.CategoricalStatsHistogramBucket]): + value_frequency_histogram_buckets (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.CategoricalStatsResult.CategoricalStatsHistogramBucket]): Histogram of value frequencies in the column. """ @@ -1974,7 +1974,7 @@ class CategoricalStatsHistogramBucket(proto.Message): values in this bucket. bucket_size (int): Total number of values in this bucket. - bucket_values (Sequence[~.dlp.ValueFrequency]): + bucket_values (Sequence[google.cloud.dlp_v2.types.ValueFrequency]): Sample of value frequencies in this bucket. The total number of values returned per bucket is capped at 20. @@ -2005,7 +2005,7 @@ class KAnonymityResult(proto.Message): r"""Result of the k-anonymity computation. Attributes: - equivalence_class_histogram_buckets (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityHistogramBucket]): + equivalence_class_histogram_buckets (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityHistogramBucket]): Histogram of k-anonymity equivalence classes. """ @@ -2014,7 +2014,7 @@ class KAnonymityEquivalenceClass(proto.Message): value Attributes: - quasi_ids_values (Sequence[~.dlp.Value]): + quasi_ids_values (Sequence[google.cloud.dlp_v2.types.Value]): Set of values defining the equivalence class. One value per quasi-identifier column in the original KAnonymity metric message. The order is @@ -2043,7 +2043,7 @@ class KAnonymityHistogramBucket(proto.Message): bucket_size (int): Total number of equivalence classes in this bucket. - bucket_values (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityEquivalenceClass]): + bucket_values (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityEquivalenceClass]): Sample of equivalence classes in this bucket. The total number of classes returned per bucket is capped at 20. @@ -2076,7 +2076,7 @@ class LDiversityResult(proto.Message): r"""Result of the l-diversity computation. Attributes: - sensitive_value_frequency_histogram_buckets (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityHistogramBucket]): + sensitive_value_frequency_histogram_buckets (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityHistogramBucket]): Histogram of l-diversity equivalence class sensitive value frequencies. """ @@ -2086,7 +2086,7 @@ class LDiversityEquivalenceClass(proto.Message): value. Attributes: - quasi_ids_values (Sequence[~.dlp.Value]): + quasi_ids_values (Sequence[google.cloud.dlp_v2.types.Value]): Quasi-identifier values defining the k-anonymity equivalence class. The order is always the same as the original request. @@ -2095,7 +2095,7 @@ class LDiversityEquivalenceClass(proto.Message): num_distinct_sensitive_values (int): Number of distinct sensitive values in this equivalence class. - top_sensitive_values (Sequence[~.dlp.ValueFrequency]): + top_sensitive_values (Sequence[google.cloud.dlp_v2.types.ValueFrequency]): Estimated frequencies of top sensitive values. """ @@ -2128,7 +2128,7 @@ class LDiversityHistogramBucket(proto.Message): bucket_size (int): Total number of equivalence classes in this bucket. - bucket_values (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityEquivalenceClass]): + bucket_values (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityEquivalenceClass]): Sample of equivalence classes in this bucket. The total number of classes returned per bucket is capped at 20. @@ -2162,7 +2162,7 @@ class KMapEstimationResult(proto.Message): results are an estimation, not exact values. Attributes: - k_map_estimation_histogram (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationHistogramBucket]): + k_map_estimation_histogram (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationHistogramBucket]): The intervals [min_anonymity, max_anonymity] do not overlap. If a value doesn't correspond to any such interval, the associated frequency is zero. For example, the following @@ -2177,7 +2177,7 @@ class KMapEstimationQuasiIdValues(proto.Message): r"""A tuple of values for the quasi-identifier columns. Attributes: - quasi_ids_values (Sequence[~.dlp.Value]): + quasi_ids_values (Sequence[google.cloud.dlp_v2.types.Value]): The quasi-identifier values. estimated_anonymity (int): The estimated anonymity for these quasi- @@ -2206,7 +2206,7 @@ class KMapEstimationHistogramBucket(proto.Message): bucket_size (int): Number of records within these anonymity bounds. - bucket_values (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationQuasiIdValues]): + bucket_values (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationQuasiIdValues]): Sample of quasi-identifier tuple values in this bucket. The total number of classes returned per bucket is capped at 20. @@ -2240,7 +2240,7 @@ class DeltaPresenceEstimationResult(proto.Message): are an estimation, not exact values. Attributes: - delta_presence_estimation_histogram (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult.DeltaPresenceEstimationHistogramBucket]): + delta_presence_estimation_histogram (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult.DeltaPresenceEstimationHistogramBucket]): The intervals [min_probability, max_probability) do not overlap. If a value doesn't correspond to any such interval, the associated frequency is zero. For example, the following @@ -2256,7 +2256,7 @@ class DeltaPresenceEstimationQuasiIdValues(proto.Message): r"""A tuple of values for the quasi-identifier columns. Attributes: - quasi_ids_values (Sequence[~.dlp.Value]): + quasi_ids_values (Sequence[google.cloud.dlp_v2.types.Value]): The quasi-identifier values. estimated_probability (float): The estimated probability that a given individual sharing @@ -2293,7 +2293,7 @@ class DeltaPresenceEstimationHistogramBucket(proto.Message): bucket_size (int): Number of records within these probability bounds. - bucket_values (Sequence[~.dlp.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult.DeltaPresenceEstimationQuasiIdValues]): + bucket_values (Sequence[google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult.DeltaPresenceEstimationQuasiIdValues]): Sample of quasi-identifier tuple values in this bucket. The total number of classes returned per bucket is capped at 20. @@ -2326,7 +2326,7 @@ class RequestedRiskAnalysisOptions(proto.Message): r"""Risk analysis options. Attributes: - job_config (~.dlp.RiskAnalysisJobConfig): + job_config (google.cloud.dlp_v2.types.RiskAnalysisJobConfig): The job config for the risk job. """ @@ -2375,7 +2375,7 @@ class ValueFrequency(proto.Message): r"""A value of a field, including its frequency. Attributes: - value (~.dlp.Value): + value (google.cloud.dlp_v2.types.Value): A value contained in the field in question. count (int): How many times the value is contained in the @@ -2404,13 +2404,13 @@ class Value(proto.Message): string boolean_value (bool): boolean - timestamp_value (~.timestamp.Timestamp): + timestamp_value (google.protobuf.timestamp_pb2.Timestamp): timestamp - time_value (~.timeofday.TimeOfDay): + time_value (google.type.timeofday_pb2.TimeOfDay): time of day - date_value (~.gt_date.Date): + date_value (google.type.date_pb2.Date): date - day_of_week_value (~.dayofweek.DayOfWeek): + day_of_week_value (google.type.dayofweek_pb2.DayOfWeek): day of week """ @@ -2443,7 +2443,7 @@ class QuoteInfo(proto.Message): r"""Message for infoType-dependent details parsed from quote. Attributes: - date_time (~.dlp.DateTime): + date_time (google.cloud.dlp_v2.types.DateTime): The date time indicated by the quote. """ @@ -2457,14 +2457,14 @@ class DateTime(proto.Message): e.g. 2018-01-01, 5th August. Attributes: - date (~.gt_date.Date): + date (google.type.date_pb2.Date): One or more of the following must be set. Must be a valid date or time value. - day_of_week (~.dayofweek.DayOfWeek): + day_of_week (google.type.dayofweek_pb2.DayOfWeek): Day of week - time (~.timeofday.TimeOfDay): + time (google.type.timeofday_pb2.TimeOfDay): Time of day - time_zone (~.dlp.DateTime.TimeZone): + time_zone (google.cloud.dlp_v2.types.DateTime.TimeZone): Time zone """ @@ -2493,15 +2493,15 @@ class DeidentifyConfig(proto.Message): r"""The configuration that controls how the data will change. Attributes: - info_type_transformations (~.dlp.InfoTypeTransformations): + info_type_transformations (google.cloud.dlp_v2.types.InfoTypeTransformations): Treat the dataset as free-form text and apply the same free text transformation everywhere. - record_transformations (~.dlp.RecordTransformations): + record_transformations (google.cloud.dlp_v2.types.RecordTransformations): Treat the dataset as structured. Transformations can be applied to specific locations within structured datasets, such as transforming a column within a table. - transformation_error_handling (~.dlp.TransformationErrorHandling): + transformation_error_handling (google.cloud.dlp_v2.types.TransformationErrorHandling): Mode for handling transformation errors. If left unspecified, the default mode is ``TransformationErrorHandling.ThrowError``. @@ -2537,9 +2537,9 @@ class TransformationErrorHandling(proto.Message): ``TransformationOverviews``. Attributes: - throw_error (~.dlp.TransformationErrorHandling.ThrowError): + throw_error (google.cloud.dlp_v2.types.TransformationErrorHandling.ThrowError): Throw an error - leave_untransformed (~.dlp.TransformationErrorHandling.LeaveUntransformed): + leave_untransformed (google.cloud.dlp_v2.types.TransformationErrorHandling.LeaveUntransformed): Ignore errors """ @@ -2568,27 +2568,27 @@ class PrimitiveTransformation(proto.Message): r"""A rule for transforming a value. Attributes: - replace_config (~.dlp.ReplaceValueConfig): + replace_config (google.cloud.dlp_v2.types.ReplaceValueConfig): Replace - redact_config (~.dlp.RedactConfig): + redact_config (google.cloud.dlp_v2.types.RedactConfig): Redact - character_mask_config (~.dlp.CharacterMaskConfig): + character_mask_config (google.cloud.dlp_v2.types.CharacterMaskConfig): Mask - crypto_replace_ffx_fpe_config (~.dlp.CryptoReplaceFfxFpeConfig): + crypto_replace_ffx_fpe_config (google.cloud.dlp_v2.types.CryptoReplaceFfxFpeConfig): Ffx-Fpe - fixed_size_bucketing_config (~.dlp.FixedSizeBucketingConfig): + fixed_size_bucketing_config (google.cloud.dlp_v2.types.FixedSizeBucketingConfig): Fixed size bucketing - bucketing_config (~.dlp.BucketingConfig): + bucketing_config (google.cloud.dlp_v2.types.BucketingConfig): Bucketing - replace_with_info_type_config (~.dlp.ReplaceWithInfoTypeConfig): + replace_with_info_type_config (google.cloud.dlp_v2.types.ReplaceWithInfoTypeConfig): Replace with infotype - time_part_config (~.dlp.TimePartConfig): + time_part_config (google.cloud.dlp_v2.types.TimePartConfig): Time extraction - crypto_hash_config (~.dlp.CryptoHashConfig): + crypto_hash_config (google.cloud.dlp_v2.types.CryptoHashConfig): Crypto - date_shift_config (~.dlp.DateShiftConfig): + date_shift_config (google.cloud.dlp_v2.types.DateShiftConfig): Date Shift - crypto_deterministic_config (~.dlp.CryptoDeterministicConfig): + crypto_deterministic_config (google.cloud.dlp_v2.types.CryptoDeterministicConfig): Deterministic Crypto """ @@ -2654,7 +2654,7 @@ class TimePartConfig(proto.Message): preserve a portion of the value. Attributes: - part_to_extract (~.dlp.TimePartConfig.TimePart): + part_to_extract (google.cloud.dlp_v2.types.TimePartConfig.TimePart): The part of the time to keep. """ @@ -2682,7 +2682,7 @@ class CryptoHashConfig(proto.Message): more. Attributes: - crypto_key (~.dlp.CryptoKey): + crypto_key (google.cloud.dlp_v2.types.CryptoKey): The key used by the hash function. """ @@ -2696,9 +2696,9 @@ class CryptoDeterministicConfig(proto.Message): the RFC https://tools.ietf.org/html/rfc5297. Attributes: - crypto_key (~.dlp.CryptoKey): + crypto_key (google.cloud.dlp_v2.types.CryptoKey): The key used by the encryption function. - surrogate_info_type (~.storage.InfoType): + surrogate_info_type (google.cloud.dlp_v2.types.InfoType): The custom info type to annotate the surrogate with. This annotation will be applied to the surrogate by prefixing it with the name of the custom info type followed by the number @@ -2736,7 +2736,7 @@ class CryptoDeterministicConfig(proto.Message): data is entered from a regular ASCII keyboard, the symbol with the hex code point 29DD might be used like so: ⧝MY_TOKEN_TYPE. - context (~.storage.FieldId): + context (google.cloud.dlp_v2.types.FieldId): A context may be used for higher security and maintaining referential integrity such that the same identifier in two different contexts will be given a distinct surrogate. The @@ -2773,7 +2773,7 @@ class ReplaceValueConfig(proto.Message): r"""Replace each input value with a given ``Value``. Attributes: - new_value (~.dlp.Value): + new_value (google.cloud.dlp_v2.types.Value): Value to replace it with. """ @@ -2799,7 +2799,7 @@ class CharsToIgnore(proto.Message): Attributes: characters_to_skip (str): Characters to not transform when masking. - common_characters_to_ignore (~.dlp.CharsToIgnore.CommonCharsToIgnore): + common_characters_to_ignore (google.cloud.dlp_v2.types.CharsToIgnore.CommonCharsToIgnore): Common characters to not transform when masking. Useful to avoid removing punctuation. """ @@ -2849,7 +2849,7 @@ class CharacterMaskConfig(proto.Message): ``00000000000000-3456``. If ``masking_character`` is ``*``, ``number_to_mask`` is ``3``, and ``reverse_order`` is ``true``, then the string ``12345`` is masked as ``12***``. - characters_to_ignore (Sequence[~.dlp.CharsToIgnore]): + characters_to_ignore (Sequence[google.cloud.dlp_v2.types.CharsToIgnore]): When masking a string, items in this list will be skipped when replacing characters. For example, if the input string is ``555-555-5555`` and you instruct Cloud DLP to skip ``-`` @@ -2889,12 +2889,12 @@ class FixedSizeBucketingConfig(proto.Message): more. Attributes: - lower_bound (~.dlp.Value): + lower_bound (google.cloud.dlp_v2.types.Value): Required. Lower bound value of buckets. All values less than ``lower_bound`` are grouped together into a single bucket; for example if ``lower_bound`` = 10, then all values less than 10 are replaced with the value "-10". - upper_bound (~.dlp.Value): + upper_bound (google.cloud.dlp_v2.types.Value): Required. Upper bound value of buckets. All values greater than upper_bound are grouped together into a single bucket; for example if ``upper_bound`` = 89, then all values greater @@ -2927,7 +2927,7 @@ class BucketingConfig(proto.Message): to learn more. Attributes: - buckets (Sequence[~.dlp.BucketingConfig.Bucket]): + buckets (Sequence[google.cloud.dlp_v2.types.BucketingConfig.Bucket]): Set of buckets. Ranges must be non- verlapping. """ @@ -2937,13 +2937,13 @@ class Bucket(proto.Message): values. Attributes: - min_ (~.dlp.Value): + min_ (google.cloud.dlp_v2.types.Value): Lower bound of the range, inclusive. Type should be the same as max if used. - max_ (~.dlp.Value): + max_ (google.cloud.dlp_v2.types.Value): Upper bound of the range, exclusive; type must match min. - replacement_value (~.dlp.Value): + replacement_value (google.cloud.dlp_v2.types.Value): Required. Replacement value for this bucket. """ @@ -2973,10 +2973,10 @@ class CryptoReplaceFfxFpeConfig(proto.Message): plus warrant referential integrity. Attributes: - crypto_key (~.dlp.CryptoKey): + crypto_key (google.cloud.dlp_v2.types.CryptoKey): Required. The key used by the encryption algorithm. - context (~.storage.FieldId): + context (google.cloud.dlp_v2.types.FieldId): The 'tweak', a context may be used for higher security since the same identifier in two different contexts won't be given the same surrogate. If the context is not set, a default @@ -3002,7 +3002,7 @@ class CryptoReplaceFfxFpeConfig(proto.Message): value 1 - a string is encoded in UTF-8 format followed by a single byte of value 2 - common_alphabet (~.dlp.CryptoReplaceFfxFpeConfig.FfxCommonNativeAlphabet): + common_alphabet (google.cloud.dlp_v2.types.CryptoReplaceFfxFpeConfig.FfxCommonNativeAlphabet): Common alphabets. custom_alphabet (str): This is supported by mapping these to the alphanumeric @@ -3017,7 +3017,7 @@ class CryptoReplaceFfxFpeConfig(proto.Message): radix (int): The native way to select the alphabet. Must be in the range [2, 95]. - surrogate_info_type (~.storage.InfoType): + surrogate_info_type (google.cloud.dlp_v2.types.InfoType): The custom infoType to annotate the surrogate with. This annotation will be applied to the surrogate by prefixing it with the name of the custom infoType followed by the number @@ -3085,11 +3085,11 @@ class CryptoKey(proto.Message): attacker cannot unwrap the data crypto key. Attributes: - transient (~.dlp.TransientCryptoKey): + transient (google.cloud.dlp_v2.types.TransientCryptoKey): Transient crypto key - unwrapped (~.dlp.UnwrappedCryptoKey): + unwrapped (google.cloud.dlp_v2.types.UnwrappedCryptoKey): Unwrapped crypto key - kms_wrapped (~.dlp.KmsWrappedCryptoKey): + kms_wrapped (google.cloud.dlp_v2.types.KmsWrappedCryptoKey): Kms wrapped key """ @@ -3174,12 +3174,12 @@ class DateShiftConfig(proto.Message): lower_bound_days (int): Required. For example, -5 means shift date to at most 5 days back in the past. - context (~.storage.FieldId): + context (google.cloud.dlp_v2.types.FieldId): Points to the field that contains the context, for example, an entity id. If set, must also set cryptoKey. If set, shift will be consistent for the given context. - crypto_key (~.dlp.CryptoKey): + crypto_key (google.cloud.dlp_v2.types.CryptoKey): Causes the shift to be computed based on this key and the context. This results in the same shift for the same context and crypto_key. If set, must also set context. Can only be @@ -3204,7 +3204,7 @@ class InfoTypeTransformations(proto.Message): specific info_type. Attributes: - transformations (Sequence[~.dlp.InfoTypeTransformations.InfoTypeTransformation]): + transformations (Sequence[google.cloud.dlp_v2.types.InfoTypeTransformations.InfoTypeTransformation]): Required. Transformation for each infoType. Cannot specify more than one for a given infoType. @@ -3215,12 +3215,12 @@ class InfoTypeTransformation(proto.Message): info_type. Attributes: - info_types (Sequence[~.storage.InfoType]): + info_types (Sequence[google.cloud.dlp_v2.types.InfoType]): InfoTypes to apply the transformation to. An empty list will cause this transformation to apply to all findings that correspond to infoTypes that were requested in ``InspectConfig``. - primitive_transformation (~.dlp.PrimitiveTransformation): + primitive_transformation (google.cloud.dlp_v2.types.PrimitiveTransformation): Required. Primitive transformation to apply to the infoType. """ @@ -3242,10 +3242,10 @@ class FieldTransformation(proto.Message): r"""The transformation to apply to the field. Attributes: - fields (Sequence[~.storage.FieldId]): + fields (Sequence[google.cloud.dlp_v2.types.FieldId]): Required. Input field(s) to apply the transformation to. - condition (~.dlp.RecordCondition): + condition (google.cloud.dlp_v2.types.RecordCondition): Only apply the transformation if the condition evaluates to true for the given ``RecordCondition``. The conditions are allowed to reference fields that are not used in the actual @@ -3258,9 +3258,9 @@ class FieldTransformation(proto.Message): specific range. - Redact a field if the date of birth field is greater than 85. - primitive_transformation (~.dlp.PrimitiveTransformation): + primitive_transformation (google.cloud.dlp_v2.types.PrimitiveTransformation): Apply the transformation to the entire field. - info_type_transformations (~.dlp.InfoTypeTransformations): + info_type_transformations (google.cloud.dlp_v2.types.InfoTypeTransformations): Treat the contents of the field as free text, and selectively transform content that matches an ``InfoType``. """ @@ -3289,10 +3289,10 @@ class RecordTransformations(proto.Message): such as a table. Attributes: - field_transformations (Sequence[~.dlp.FieldTransformation]): + field_transformations (Sequence[google.cloud.dlp_v2.types.FieldTransformation]): Transform the record by applying various field transformations. - record_suppressions (Sequence[~.dlp.RecordSuppression]): + record_suppressions (Sequence[google.cloud.dlp_v2.types.RecordSuppression]): Configuration defining which records get suppressed entirely. Records that match any suppression rule are omitted from the output. @@ -3312,7 +3312,7 @@ class RecordSuppression(proto.Message): conditions evaluate to true. Attributes: - condition (~.dlp.RecordCondition): + condition (google.cloud.dlp_v2.types.RecordCondition): A condition that when it evaluates to true will result in the record being evaluated to be suppressed from the transformed content. @@ -3326,7 +3326,7 @@ class RecordCondition(proto.Message): be applied to a field. Attributes: - expressions (~.dlp.RecordCondition.Expressions): + expressions (google.cloud.dlp_v2.types.RecordCondition.Expressions): An expression. """ @@ -3352,13 +3352,13 @@ class Condition(proto.Message): and the condition will evaluate to false. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Required. Field within the record this condition is evaluated against. - operator (~.dlp.RelationalOperator): + operator (google.cloud.dlp_v2.types.RelationalOperator): Required. Operator used to compare the field or infoType to the value. - value (~.dlp.Value): + value (google.cloud.dlp_v2.types.Value): Value to compare against. [Mandatory, except for ``EXISTS`` tests.] """ @@ -3373,7 +3373,7 @@ class Conditions(proto.Message): r"""A collection of conditions. Attributes: - conditions (Sequence[~.dlp.RecordCondition.Condition]): + conditions (Sequence[google.cloud.dlp_v2.types.RecordCondition.Condition]): A collection of conditions. """ @@ -3385,10 +3385,10 @@ class Expressions(proto.Message): r"""An expression, consisting or an operator and conditions. Attributes: - logical_operator (~.dlp.RecordCondition.Expressions.LogicalOperator): + logical_operator (google.cloud.dlp_v2.types.RecordCondition.Expressions.LogicalOperator): The operator to apply to the result of conditions. Default and currently only supported value is ``AND``. - conditions (~.dlp.RecordCondition.Conditions): + conditions (google.cloud.dlp_v2.types.RecordCondition.Conditions): Conditions to apply to the expression. """ @@ -3415,7 +3415,7 @@ class TransformationOverview(proto.Message): transformed_bytes (int): Total size in bytes that were transformed in some way. - transformation_summaries (Sequence[~.dlp.TransformationSummary]): + transformation_summaries (Sequence[google.cloud.dlp_v2.types.TransformationSummary]): Transformations applied to the dataset. """ @@ -3431,24 +3431,24 @@ class TransformationSummary(proto.Message): 'field_transformation', or 'record_suppress' will be set. Attributes: - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): Set if the transformation was limited to a specific InfoType. - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Set if the transformation was limited to a specific FieldId. - transformation (~.dlp.PrimitiveTransformation): + transformation (google.cloud.dlp_v2.types.PrimitiveTransformation): The specific transformation these stats apply to. - field_transformations (Sequence[~.dlp.FieldTransformation]): + field_transformations (Sequence[google.cloud.dlp_v2.types.FieldTransformation]): The field transformation that was applied. If multiple field transformations are requested for a single field, this list will contain all of them; otherwise, only one is supplied. - record_suppress (~.dlp.RecordSuppression): + record_suppress (google.cloud.dlp_v2.types.RecordSuppression): The specific suppression option these stats apply to. - results (Sequence[~.dlp.TransformationSummary.SummaryResult]): + results (Sequence[google.cloud.dlp_v2.types.TransformationSummary.SummaryResult]): Collection of all transformations that took place or had an error. transformed_bytes (int): @@ -3470,7 +3470,7 @@ class SummaryResult(proto.Message): count (int): Number of transformations counted by this result. - code (~.dlp.TransformationSummary.TransformationResultCode): + code (google.cloud.dlp_v2.types.TransformationSummary.TransformationResultCode): Outcome of the transformation. details (str): A place for warnings or errors to show up if @@ -3508,7 +3508,7 @@ class Schedule(proto.Message): r"""Schedule for triggeredJobs. Attributes: - recurrence_period_duration (~.duration.Duration): + recurrence_period_duration (google.protobuf.duration_pb2.Duration): With this option a job is started a regular periodic basis. For example: every day (86400 seconds). @@ -3549,13 +3549,13 @@ class InspectTemplate(proto.Message): Display name (max 256 chars). description (str): Short description (max 256 chars). - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The creation timestamp of an inspectTemplate. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update timestamp of an inspectTemplate. - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): The core content of the template. Configuration of the scanning process. """ @@ -3589,13 +3589,13 @@ class DeidentifyTemplate(proto.Message): Display name (max 256 chars). description (str): Short description (max 256 chars). - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The creation timestamp of an inspectTemplate. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update timestamp of an inspectTemplate. - deidentify_config (~.dlp.DeidentifyConfig): + deidentify_config (google.cloud.dlp_v2.types.DeidentifyConfig): ///////////// // The core content of the template // /////////////// """ @@ -3621,9 +3621,9 @@ class Error(proto.Message): JobTrigger. Attributes: - details (~.gr_status.Status): + details (google.rpc.status_pb2.Status): Detailed error codes and messages. - timestamps (Sequence[~.timestamp.Timestamp]): + timestamps (Sequence[google.protobuf.timestamp_pb2.Timestamp]): The times the error occurred. """ @@ -3648,32 +3648,32 @@ class JobTrigger(proto.Message): Display name (max 100 chars) description (str): User provided description (max 256 chars) - inspect_job (~.dlp.InspectJobConfig): + inspect_job (google.cloud.dlp_v2.types.InspectJobConfig): For inspect jobs, a snapshot of the configuration. - triggers (Sequence[~.dlp.JobTrigger.Trigger]): + triggers (Sequence[google.cloud.dlp_v2.types.JobTrigger.Trigger]): A list of triggers which will be OR'ed together. Only one in the list needs to trigger for a job to be started. The list may contain only a single Schedule trigger and must have at least one object. - errors (Sequence[~.dlp.Error]): + errors (Sequence[google.cloud.dlp_v2.types.Error]): Output only. A stream of errors encountered when the trigger was activated. Repeated errors may result in the JobTrigger automatically being paused. Will return the last 100 errors. Whenever the JobTrigger is modified this list will be cleared. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The creation timestamp of a triggeredJob. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update timestamp of a triggeredJob. - last_run_time (~.timestamp.Timestamp): + last_run_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp of the last time this trigger executed. - status (~.dlp.JobTrigger.Status): + status (google.cloud.dlp_v2.types.JobTrigger.Status): Required. A status for this trigger. """ @@ -3693,10 +3693,10 @@ class Trigger(proto.Message): r"""What event needs to occur for a new job to be started. Attributes: - schedule (~.dlp.Schedule): + schedule (google.cloud.dlp_v2.types.Schedule): Create a job on a repeating basis based on the elapse of time. - manual (~.dlp.Manual): + manual (google.cloud.dlp_v2.types.Manual): For use with hybrid jobs. Jobs must be manually created and finished. Early access feature is in a pre-release state and might @@ -3743,20 +3743,20 @@ class Action(proto.Message): more. Attributes: - save_findings (~.dlp.Action.SaveFindings): + save_findings (google.cloud.dlp_v2.types.Action.SaveFindings): Save resulting findings in a provided location. - pub_sub (~.dlp.Action.PublishToPubSub): + pub_sub (google.cloud.dlp_v2.types.Action.PublishToPubSub): Publish a notification to a pubsub topic. - publish_summary_to_cscc (~.dlp.Action.PublishSummaryToCscc): + publish_summary_to_cscc (google.cloud.dlp_v2.types.Action.PublishSummaryToCscc): Publish summary to Cloud Security Command Center (Alpha). - publish_findings_to_cloud_data_catalog (~.dlp.Action.PublishFindingsToCloudDataCatalog): + publish_findings_to_cloud_data_catalog (google.cloud.dlp_v2.types.Action.PublishFindingsToCloudDataCatalog): Publish findings to Cloud Datahub. - job_notification_emails (~.dlp.Action.JobNotificationEmails): + job_notification_emails (google.cloud.dlp_v2.types.Action.JobNotificationEmails): Enable email notification for project owners and editors on job's completion/failure. - publish_to_stackdriver (~.dlp.Action.PublishToStackdriver): + publish_to_stackdriver (google.cloud.dlp_v2.types.Action.PublishToStackdriver): Enable Stackdriver metric dlp.googleapis.com/finding_count. """ @@ -3767,7 +3767,7 @@ class SaveFindings(proto.Message): Compatible with: Inspect, Risk Attributes: - output_config (~.dlp.OutputStorageConfig): + output_config (google.cloud.dlp_v2.types.OutputStorageConfig): Location to store findings outside of DLP. """ @@ -3890,7 +3890,7 @@ class CreateInspectTemplateRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - inspect_template (~.dlp.InspectTemplate): + inspect_template (google.cloud.dlp_v2.types.InspectTemplate): Required. The InspectTemplate to create. template_id (str): The template id can contain uppercase and lowercase letters, @@ -3920,9 +3920,9 @@ class UpdateInspectTemplateRequest(proto.Message): to be updated, for example ``organizations/433245324/inspectTemplates/432452342`` or projects/project-id/inspectTemplates/432452342. - inspect_template (~.dlp.InspectTemplate): + inspect_template (google.cloud.dlp_v2.types.InspectTemplate): New InspectTemplate value. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. """ @@ -4016,7 +4016,7 @@ class ListInspectTemplatesResponse(proto.Message): r"""Response message for ListInspectTemplates. Attributes: - inspect_templates (Sequence[~.dlp.InspectTemplate]): + inspect_templates (Sequence[google.cloud.dlp_v2.types.InspectTemplate]): List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. next_page_token (str): @@ -4073,7 +4073,7 @@ class CreateJobTriggerRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - job_trigger (~.dlp.JobTrigger): + job_trigger (google.cloud.dlp_v2.types.JobTrigger): Required. The JobTrigger to create. trigger_id (str): The trigger id can contain uppercase and lowercase letters, @@ -4114,9 +4114,9 @@ class UpdateJobTriggerRequest(proto.Message): Required. Resource name of the project and the triggeredJob, for example ``projects/dlp-test-project/jobTriggers/53234423``. - job_trigger (~.dlp.JobTrigger): + job_trigger (google.cloud.dlp_v2.types.JobTrigger): New JobTrigger value. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. """ @@ -4165,9 +4165,9 @@ class CreateDlpJobRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - inspect_job (~.dlp.InspectJobConfig): + inspect_job (google.cloud.dlp_v2.types.InspectJobConfig): Set to control what and how to inspect. - risk_job (~.dlp.RiskAnalysisJobConfig): + risk_job (google.cloud.dlp_v2.types.RiskAnalysisJobConfig): Set to choose what metric to calculate. job_id (str): The job id can contain uppercase and lowercase letters, @@ -4301,7 +4301,7 @@ class ListJobTriggersResponse(proto.Message): r"""Response message for ListJobTriggers. Attributes: - job_triggers (Sequence[~.dlp.JobTrigger]): + job_triggers (Sequence[google.cloud.dlp_v2.types.JobTrigger]): List of triggeredJobs, up to page_size in ListJobTriggersRequest. next_page_token (str): @@ -4336,15 +4336,15 @@ class InspectJobConfig(proto.Message): r"""Controls what and how to inspect for findings. Attributes: - storage_config (~.storage.StorageConfig): + storage_config (google.cloud.dlp_v2.types.StorageConfig): The data to scan. - inspect_config (~.dlp.InspectConfig): + inspect_config (google.cloud.dlp_v2.types.InspectConfig): How and what to scan for. inspect_template_name (str): If provided, will be used as the default for all values in InspectConfig. ``inspect_config`` will be merged into the values persisted as part of the template. - actions (Sequence[~.dlp.Action]): + actions (Sequence[google.cloud.dlp_v2.types.Action]): Actions to execute at the completion of the job. """ @@ -4366,24 +4366,24 @@ class DlpJob(proto.Message): Attributes: name (str): The server-assigned name. - type_ (~.dlp.DlpJobType): + type_ (google.cloud.dlp_v2.types.DlpJobType): The type of job. - state (~.dlp.DlpJob.JobState): + state (google.cloud.dlp_v2.types.DlpJob.JobState): State of a job. - risk_details (~.dlp.AnalyzeDataSourceRiskDetails): + risk_details (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails): Results from analyzing risk of a data source. - inspect_details (~.dlp.InspectDataSourceDetails): + inspect_details (google.cloud.dlp_v2.types.InspectDataSourceDetails): Results from inspecting a data source. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Time when the job was created. - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Time when the job started. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): Time when the job finished. job_trigger_name (str): If created by a job trigger, the resource name of the trigger that instantiated the job. - errors (Sequence[~.dlp.Error]): + errors (Sequence[google.cloud.dlp_v2.types.Error]): A stream of errors encountered running the job. """ @@ -4505,7 +4505,7 @@ class ListDlpJobsRequest(proto.Message): The standard list page size. page_token (str): The standard list page token. - type_ (~.dlp.DlpJobType): + type_ (google.cloud.dlp_v2.types.DlpJobType): The type of job. Defaults to ``DlpJobType.INSPECT`` order_by (str): Comma separated list of fields to order by, followed by @@ -4544,7 +4544,7 @@ class ListDlpJobsResponse(proto.Message): r"""The response message for listing DLP jobs. Attributes: - jobs (Sequence[~.dlp.DlpJob]): + jobs (Sequence[google.cloud.dlp_v2.types.DlpJob]): A list of DlpJobs that matches the specified filter in the request. next_page_token (str): @@ -4624,7 +4624,7 @@ class CreateDeidentifyTemplateRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - deidentify_template (~.dlp.DeidentifyTemplate): + deidentify_template (google.cloud.dlp_v2.types.DeidentifyTemplate): Required. The DeidentifyTemplate to create. template_id (str): The template id can contain uppercase and lowercase letters, @@ -4656,9 +4656,9 @@ class UpdateDeidentifyTemplateRequest(proto.Message): template to be updated, for example ``organizations/433245324/deidentifyTemplates/432452342`` or projects/project-id/deidentifyTemplates/432452342. - deidentify_template (~.dlp.DeidentifyTemplate): + deidentify_template (google.cloud.dlp_v2.types.DeidentifyTemplate): New DeidentifyTemplate value. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. """ @@ -4754,7 +4754,7 @@ class ListDeidentifyTemplatesResponse(proto.Message): r"""Response message for ListDeidentifyTemplates. Attributes: - deidentify_templates (Sequence[~.dlp.DeidentifyTemplate]): + deidentify_templates (Sequence[google.cloud.dlp_v2.types.DeidentifyTemplate]): List of deidentify templates, up to page_size in ListDeidentifyTemplatesRequest. next_page_token (str): @@ -4797,17 +4797,17 @@ class LargeCustomDictionaryConfig(proto.Message): smaller dictionaries that satisfy the size requirements. Attributes: - output_path (~.storage.CloudStoragePath): + output_path (google.cloud.dlp_v2.types.CloudStoragePath): Location to store dictionary artifacts in Google Cloud Storage. These files will only be accessible by project owners and the DLP API. If any of these artifacts are modified, the dictionary is considered invalid and can no longer be used. - cloud_storage_file_set (~.storage.CloudStorageFileSet): + cloud_storage_file_set (google.cloud.dlp_v2.types.CloudStorageFileSet): Set of files containing newline-delimited lists of dictionary phrases. - big_query_field (~.storage.BigQueryField): + big_query_field (google.cloud.dlp_v2.types.BigQueryField): Field in a BigQuery table where each cell represents a dictionary phrase. """ @@ -4849,12 +4849,12 @@ class StoredInfoTypeConfig(proto.Message): description (str): Description of the StoredInfoType (max 256 characters). - large_custom_dictionary (~.dlp.LargeCustomDictionaryConfig): + large_custom_dictionary (google.cloud.dlp_v2.types.LargeCustomDictionaryConfig): StoredInfoType where findings are defined by a dictionary of phrases. - dictionary (~.storage.CustomInfoType.Dictionary): + dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): Store dictionary-based CustomInfoType. - regex (~.storage.CustomInfoType.Regex): + regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Store regular expression-based StoredInfoType. """ @@ -4883,7 +4883,7 @@ class StoredInfoTypeStats(proto.Message): r"""Statistics for a StoredInfoType. Attributes: - large_custom_dictionary (~.dlp.LargeCustomDictionaryStats): + large_custom_dictionary (google.cloud.dlp_v2.types.LargeCustomDictionaryStats): StoredInfoType where findings are defined by a dictionary of phrases. """ @@ -4898,17 +4898,17 @@ class StoredInfoTypeVersion(proto.Message): to build it, create timestamp, and current state. Attributes: - config (~.dlp.StoredInfoTypeConfig): + config (google.cloud.dlp_v2.types.StoredInfoTypeConfig): StoredInfoType configuration. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Create timestamp of the version. Read-only, determined by the system when the version is created. - state (~.dlp.StoredInfoTypeState): + state (google.cloud.dlp_v2.types.StoredInfoTypeState): Stored info type version state. Read-only, updated by the system during dictionary creation. - errors (Sequence[~.dlp.Error]): + errors (Sequence[google.cloud.dlp_v2.types.Error]): Errors that occurred when creating this storedInfoType version, or anomalies detected in the storedInfoType data that render it unusable. Only the five most recent errors @@ -4925,7 +4925,7 @@ class StoredInfoTypeVersion(proto.Message): create another version of the storedInfoType to continue using it, reusing the same ``config`` if it was not the source of the error. - stats (~.dlp.StoredInfoTypeStats): + stats (google.cloud.dlp_v2.types.StoredInfoTypeStats): Statistics about this storedInfoType version. """ @@ -4947,9 +4947,9 @@ class StoredInfoType(proto.Message): Attributes: name (str): Resource name. - current_version (~.dlp.StoredInfoTypeVersion): + current_version (google.cloud.dlp_v2.types.StoredInfoTypeVersion): Current version of the stored info type. - pending_versions (Sequence[~.dlp.StoredInfoTypeVersion]): + pending_versions (Sequence[google.cloud.dlp_v2.types.StoredInfoTypeVersion]): Pending versions of the stored info type. Empty if no versions are pending. """ @@ -4993,7 +4993,7 @@ class CreateStoredInfoTypeRequest(proto.Message): :: parent=projects/example-project/locations/europe-west3 - config (~.dlp.StoredInfoTypeConfig): + config (google.cloud.dlp_v2.types.StoredInfoTypeConfig): Required. Configuration of the storedInfoType to create. stored_info_type_id (str): @@ -5024,12 +5024,12 @@ class UpdateStoredInfoTypeRequest(proto.Message): to be updated, for example ``organizations/433245324/storedInfoTypes/432452342`` or projects/project-id/storedInfoTypes/432452342. - config (~.dlp.StoredInfoTypeConfig): + config (google.cloud.dlp_v2.types.StoredInfoTypeConfig): Updated configuration for the storedInfoType. If not provided, a new version of the storedInfoType will be created with the existing configuration. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask to control which fields get updated. """ @@ -5123,7 +5123,7 @@ class ListStoredInfoTypesResponse(proto.Message): r"""Response message for ListStoredInfoTypes. Attributes: - stored_info_types (Sequence[~.dlp.StoredInfoType]): + stored_info_types (Sequence[google.cloud.dlp_v2.types.StoredInfoType]): List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. next_page_token (str): @@ -5166,7 +5166,7 @@ class HybridInspectJobTriggerRequest(proto.Message): Required. Resource name of the trigger to execute a hybrid inspect on, for example ``projects/dlp-test-project/jobTriggers/53234423``. - hybrid_item (~.dlp.HybridContentItem): + hybrid_item (google.cloud.dlp_v2.types.HybridContentItem): The item to inspect. """ @@ -5184,7 +5184,7 @@ class HybridInspectDlpJobRequest(proto.Message): Required. Resource name of the job to execute a hybrid inspect on, for example ``projects/dlp-test-project/dlpJob/53234423``. - hybrid_item (~.dlp.HybridContentItem): + hybrid_item (google.cloud.dlp_v2.types.HybridContentItem): The item to inspect. """ @@ -5198,9 +5198,9 @@ class HybridContentItem(proto.Message): temporarily during processing. Attributes: - item (~.dlp.ContentItem): + item (google.cloud.dlp_v2.types.ContentItem): The item to inspect. - finding_details (~.dlp.HybridFindingDetails): + finding_details (google.cloud.dlp_v2.types.HybridFindingDetails): Supplementary information that will be added to each finding. """ @@ -5216,7 +5216,7 @@ class HybridFindingDetails(proto.Message): r"""Populate to associate additional data with each finding. Attributes: - container_details (~.dlp.Container): + container_details (google.cloud.dlp_v2.types.Container): Details about the container where the content being inspected is from. file_offset (int): @@ -5231,14 +5231,14 @@ class HybridFindingDetails(proto.Message): row(s) being scanned are part of a bigger dataset and you want to keep track of their absolute position. - table_options (~.storage.TableOptions): + table_options (google.cloud.dlp_v2.types.TableOptions): If the container is a table, additional information to make findings meaningful such as the columns that are primary keys. If not known ahead of time, can also be set within each inspect hybrid call and the two will be merged. Note that identifying_fields will only be stored to BigQuery, and only if the BigQuery action has been included. - labels (Sequence[~.dlp.HybridFindingDetails.LabelsEntry]): + labels (Sequence[google.cloud.dlp_v2.types.HybridFindingDetails.LabelsEntry]): Labels to represent user provided metadata about the data being inspected. If configured by the job, some key values may be required. The labels associated with ``Finding``'s diff --git a/google/cloud/dlp_v2/types/storage.py b/google/cloud/dlp_v2/types/storage.py index c4cd5ac4..e76efd06 100644 --- a/google/cloud/dlp_v2/types/storage.py +++ b/google/cloud/dlp_v2/types/storage.py @@ -105,7 +105,7 @@ class StoredType(proto.Message): example ``organizations/433245324/storedInfoTypes/432452342`` or ``projects/project-id/storedInfoTypes/432452342``. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp indicating when the version of the ``StoredInfoType`` used for inspection was created. Output-only field, populated by the system. @@ -122,7 +122,7 @@ class CustomInfoType(proto.Message): in question. Attributes: - info_type (~.storage.InfoType): + info_type (google.cloud.dlp_v2.types.InfoType): CustomInfoType can either be a new infoType, or an extension of built-in infoType, when the name matches one of existing infoTypes and that infoType is specified in @@ -130,30 +130,30 @@ class CustomInfoType(proto.Message): adds findings to the one detected by the system. If built-in info type is not specified in ``InspectContent.info_types`` list then the name is treated as a custom info type. - likelihood (~.storage.Likelihood): + likelihood (google.cloud.dlp_v2.types.Likelihood): Likelihood to return for this CustomInfoType. This base value can be altered by a detection rule if the finding meets the criteria specified by the rule. Defaults to ``VERY_LIKELY`` if not specified. - dictionary (~.storage.CustomInfoType.Dictionary): + dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): A list of phrases to detect as a CustomInfoType. - regex (~.storage.CustomInfoType.Regex): + regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Regular expression based CustomInfoType. - surrogate_type (~.storage.CustomInfoType.SurrogateType): + surrogate_type (google.cloud.dlp_v2.types.CustomInfoType.SurrogateType): Message for detecting output from deidentification transformations that support reversing. - stored_type (~.storage.StoredType): + stored_type (google.cloud.dlp_v2.types.StoredType): Load an existing ``StoredInfoType`` resource for use in ``InspectDataSource``. Not currently supported in ``InspectContent``. - detection_rules (Sequence[~.storage.CustomInfoType.DetectionRule]): + detection_rules (Sequence[google.cloud.dlp_v2.types.CustomInfoType.DetectionRule]): Set of detection rules to apply to all findings of this CustomInfoType. Rules are applied in order that they are specified. Not supported for the ``surrogate_type`` CustomInfoType. - exclusion_type (~.storage.CustomInfoType.ExclusionType): + exclusion_type (google.cloud.dlp_v2.types.CustomInfoType.ExclusionType): If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding to be returned. It still can be used for rules matching. @@ -190,9 +190,9 @@ class Dictionary(proto.Message): ``LargeCustomDictionaryConfig`` in the ``StoredInfoType`` API. Attributes: - word_list (~.storage.CustomInfoType.Dictionary.WordList): + word_list (google.cloud.dlp_v2.types.CustomInfoType.Dictionary.WordList): List of words or phrases to search for. - cloud_storage_path (~.storage.CloudStoragePath): + cloud_storage_path (google.cloud.dlp_v2.types.CloudStoragePath): Newline-delimited file of words in Cloud Storage. Only a single file is accepted. """ @@ -260,7 +260,7 @@ class DetectionRule(proto.Message): ``surrogate_type`` custom infoType. Attributes: - hotword_rule (~.storage.CustomInfoType.DetectionRule.HotwordRule): + hotword_rule (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.HotwordRule): Hotword-based detection rule. """ @@ -286,7 +286,7 @@ class LikelihoodAdjustment(proto.Message): finding as part of a detection rule. Attributes: - fixed_likelihood (~.storage.Likelihood): + fixed_likelihood (google.cloud.dlp_v2.types.Likelihood): Set the likelihood of a finding to a fixed value. relative_likelihood (int): @@ -312,10 +312,10 @@ class HotwordRule(proto.Message): certain proximity of hotwords. Attributes: - hotword_regex (~.storage.CustomInfoType.Regex): + hotword_regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Regular expression pattern defining what qualifies as a hotword. - proximity (~.storage.CustomInfoType.DetectionRule.Proximity): + proximity (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.Proximity): Proximity of the finding within which the entire hotword must reside. The total length of the window cannot exceed 1000 characters. Note @@ -328,7 +328,7 @@ class HotwordRule(proto.Message): a company office using the hotword regex "\(xxx\)", where "xxx" is the area code in question. - likelihood_adjustment (~.storage.CustomInfoType.DetectionRule.LikelihoodAdjustment): + likelihood_adjustment (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.LikelihoodAdjustment): Likelihood adjustment to apply to all matching findings. """ @@ -427,12 +427,12 @@ class DatastoreOptions(proto.Message): r"""Options defining a data set within Google Cloud Datastore. Attributes: - partition_id (~.storage.PartitionId): + partition_id (google.cloud.dlp_v2.types.PartitionId): A partition ID identifies a grouping of entities. The grouping is always by project and namespace, however the namespace ID may be empty. - kind (~.storage.KindExpression): + kind (google.cloud.dlp_v2.types.KindExpression): The kind to process. """ @@ -515,7 +515,7 @@ class CloudStorageOptions(proto.Message): Cloud Storage bucket. Attributes: - file_set (~.storage.CloudStorageOptions.FileSet): + file_set (google.cloud.dlp_v2.types.CloudStorageOptions.FileSet): The set of one or more files to scan. bytes_limit_per_file (int): Max number of bytes to scan from a file. If a scanned file's @@ -528,7 +528,7 @@ class CloudStorageOptions(proto.Message): be between 0 and 100, inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - file_types (Sequence[~.storage.FileType]): + file_types (Sequence[google.cloud.dlp_v2.types.FileType]): List of file type groups to include in the scan. If empty, all files are scanned and available data format processors are applied. In addition, the binary content of the selected @@ -537,7 +537,7 @@ class CloudStorageOptions(proto.Message): inspection and no file_types were specified. Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. - sample_method (~.storage.CloudStorageOptions.SampleMethod): + sample_method (google.cloud.dlp_v2.types.CloudStorageOptions.SampleMethod): files_limit_percent (int): Limits the number of files to scan to this @@ -573,7 +573,7 @@ class FileSet(proto.Message): equivalent to ``gs://mybucket/directory/*``. Exactly one of ``url`` or ``regex_file_set`` must be set. - regex_file_set (~.storage.CloudStorageRegexFileSet): + regex_file_set (google.cloud.dlp_v2.types.CloudStorageRegexFileSet): The regex-filtered set of files to scan. Exactly one of ``url`` or ``regex_file_set`` must be set. """ @@ -625,9 +625,9 @@ class BigQueryOptions(proto.Message): r"""Options defining BigQuery table and row identifiers. Attributes: - table_reference (~.storage.BigQueryTable): + table_reference (google.cloud.dlp_v2.types.BigQueryTable): Complete BigQuery table reference. - identifying_fields (Sequence[~.storage.FieldId]): + identifying_fields (Sequence[google.cloud.dlp_v2.types.FieldId]): Table fields that may uniquely identify a row within the table. When ``actions.saveFindings.outputConfig.table`` is specified, the values of columns specified here are @@ -647,9 +647,9 @@ class BigQueryOptions(proto.Message): Defaults to 0. Only one of rows_limit and rows_limit_percent can be specified. Cannot be used in conjunction with TimespanConfig. - sample_method (~.storage.BigQueryOptions.SampleMethod): + sample_method (google.cloud.dlp_v2.types.BigQueryOptions.SampleMethod): - excluded_fields (Sequence[~.storage.FieldId]): + excluded_fields (Sequence[google.cloud.dlp_v2.types.FieldId]): References to fields excluded from scanning. This allows you to skip inspection of entire columns which you know have no findings. @@ -683,20 +683,20 @@ class StorageConfig(proto.Message): r"""Shared message indicating Cloud storage type. Attributes: - datastore_options (~.storage.DatastoreOptions): + datastore_options (google.cloud.dlp_v2.types.DatastoreOptions): Google Cloud Datastore options. - cloud_storage_options (~.storage.CloudStorageOptions): + cloud_storage_options (google.cloud.dlp_v2.types.CloudStorageOptions): Google Cloud Storage options. - big_query_options (~.storage.BigQueryOptions): + big_query_options (google.cloud.dlp_v2.types.BigQueryOptions): BigQuery options. - hybrid_options (~.storage.HybridOptions): + hybrid_options (google.cloud.dlp_v2.types.HybridOptions): Hybrid inspection options. Early access feature is in a pre-release state and might change or have limited support. For more information, see https://cloud.google.com/products#product- launch-stages. - timespan_config (~.storage.StorageConfig.TimespanConfig): + timespan_config (google.cloud.dlp_v2.types.StorageConfig.TimespanConfig): """ @@ -706,15 +706,15 @@ class TimespanConfig(proto.Message): Storage and BigQuery. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Exclude files, tables, or rows older than this value. If not set, no lower time limit is applied. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): Exclude files, tables, or rows newer than this value. If not set, no upper time limit is applied. - timestamp_field (~.storage.FieldId): + timestamp_field (google.cloud.dlp_v2.types.FieldId): Specification of the field containing the timestamp of scanned items. Used for data sources like Datastore and BigQuery. @@ -788,7 +788,7 @@ class HybridOptions(proto.Message): ``[a-z]([-a-z0-9]*[a-z0-9])?``. No more than 10 keys can be required. - labels (Sequence[~.storage.HybridOptions.LabelsEntry]): + labels (Sequence[google.cloud.dlp_v2.types.HybridOptions.LabelsEntry]): To organize findings, these labels will be added to each finding. @@ -807,7 +807,7 @@ class HybridOptions(proto.Message): - ``"environment" : "production"`` - ``"pipeline" : "etl"`` - table_options (~.storage.TableOptions): + table_options (google.cloud.dlp_v2.types.TableOptions): If the container is a table, additional information to make findings meaningful such as the columns that are primary keys. @@ -826,7 +826,7 @@ class BigQueryKey(proto.Message): r"""Row key for identifying a record in BigQuery table. Attributes: - table_reference (~.storage.BigQueryTable): + table_reference (google.cloud.dlp_v2.types.BigQueryTable): Complete BigQuery table reference. row_number (int): Row number inferred at the time the table was scanned. This @@ -846,7 +846,7 @@ class DatastoreKey(proto.Message): r"""Record key for a finding in Cloud Datastore. Attributes: - entity_key (~.storage.Key): + entity_key (google.cloud.dlp_v2.types.Key): Datastore entity key. """ @@ -861,12 +861,12 @@ class Key(proto.Message): contexts. Attributes: - partition_id (~.storage.PartitionId): + partition_id (google.cloud.dlp_v2.types.PartitionId): Entities are partitioned into subsets, currently identified by a project ID and namespace ID. Queries are scoped to a single partition. - path (Sequence[~.storage.Key.PathElement]): + path (Sequence[google.cloud.dlp_v2.types.Key.PathElement]): The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element @@ -917,9 +917,9 @@ class RecordKey(proto.Message): finding. Attributes: - datastore_key (~.storage.DatastoreKey): + datastore_key (google.cloud.dlp_v2.types.DatastoreKey): - big_query_key (~.storage.BigQueryKey): + big_query_key (google.cloud.dlp_v2.types.BigQueryKey): id_values (Sequence[str]): Values of identifying columns in the given row. Order of @@ -967,9 +967,9 @@ class BigQueryField(proto.Message): r"""Message defining a field of a BigQuery table. Attributes: - table (~.storage.BigQueryTable): + table (google.cloud.dlp_v2.types.BigQueryTable): Source table of the field. - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Designated field in the BigQuery table. """ @@ -987,7 +987,7 @@ class EntityId(proto.Message): same entity. Attributes: - field (~.storage.FieldId): + field (google.cloud.dlp_v2.types.FieldId): Composite key indicating which field contains the entity identifier. """ @@ -999,7 +999,7 @@ class TableOptions(proto.Message): r"""Instructions regarding the table content being inspected. Attributes: - identifying_fields (Sequence[~.storage.FieldId]): + identifying_fields (Sequence[google.cloud.dlp_v2.types.FieldId]): The columns that are the primary keys for table objects included in ContentItem. A copy of this cell's value will stored alongside diff --git a/noxfile.py b/noxfile.py index 25452f0b..d2ce164b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -18,6 +18,7 @@ from __future__ import absolute_import import os +import pathlib import shutil import nox @@ -30,6 +31,22 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +# 'docfx' is excluded since it only needs to run in 'docs-presubmit' +nox.options.sessions = [ + "unit", + "system", + "cover", + "lint", + "lint_setup_py", + "blacken", + "docs", +] + +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + @nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): @@ -70,17 +87,21 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. - session.install("asyncmock", "pytest-asyncio") - session.install( - "mock", "pytest", "pytest-cov", + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install("-e", ".") + session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) + + session.install("mock", "pytest", "pytest-cov", "-c", constraints_path) + + session.install("-e", ".", "-c", constraints_path) # Run py.test against the unit tests. session.run( "py.test", "--quiet", + f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google/cloud", "--cov=tests/unit", "--cov-append", @@ -101,6 +122,9 @@ def unit(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -110,6 +134,9 @@ def system(session): # Sanity check: Only run tests if the environment variable is set. if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): session.skip("Credentials must be set via environment variable") + # Install pyopenssl for mTLS testing. + if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": + session.install("pyopenssl") system_test_exists = os.path.exists(system_test_path) system_test_folder_exists = os.path.exists(system_test_folder_path) @@ -122,17 +149,28 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install( - "mock", "pytest", "google-cloud-testutils", - ) - session.install("-e", "test_utils") - session.install("-e", ".") + session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) + session.install("-e", "test_utils", "-c", constraints_path) + + session.install("-e", ".", "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: - session.run("py.test", "--quiet", system_test_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_path, + *session.posargs, + ) if system_test_folder_exists: - session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_folder_path, + *session.posargs, + ) @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -143,7 +181,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") + session.run("coverage", "report", "--show-missing", "--fail-under=98") session.run("coverage", "erase") @@ -175,9 +213,7 @@ def docfx(session): """Build the docfx yaml files for this library.""" session.install("-e", ".") - # sphinx-docfx-yaml supports up to sphinx version 1.5.5. - # https://github.com/docascode/sphinx-docfx-yaml/issues/97 - session.install("sphinx==1.5.5", "alabaster", "recommonmark", "sphinx-docfx-yaml") + session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/renovate.json b/renovate.json index 4fa94931..f08bc22c 100644 --- a/renovate.json +++ b/renovate.json @@ -1,5 +1,6 @@ { "extends": [ "config:base", ":preserveSemverRanges" - ] + ], + "ignorePaths": [".pre-commit-config.yaml"] } diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index bca0522e..97bf7da8 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -85,7 +85,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to tested samples. -ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"] +ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] diff --git a/setup.py b/setup.py index c2f605ee..f43d33f8 100644 --- a/setup.py +++ b/setup.py @@ -24,11 +24,12 @@ version = "3.0.1" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.22.0, < 2.0.0dev", + "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", "proto-plus >= 0.4.0", - "libcst >= 0.2.5", ] +extras = {"libcst": "libcst >= 0.2.5"} + package_root = os.path.abspath(os.path.dirname(__file__)) readme_filename = os.path.join(package_root, "README.rst") @@ -70,6 +71,7 @@ packages=packages, namespace_packages=namespaces, install_requires=dependencies, + extras_requires=extras, python_requires=">=3.6", scripts=["scripts/fixup_dlp_v2_keywords.py"], include_package_data=True, diff --git a/synth.metadata b/synth.metadata index 69d5a27a..20519aa3 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,30 +3,30 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/python-dlp.git", - "sha": "1911aad2b399102a9a00bdcf676598c241729cfb" + "remote": "git@github.com:googleapis/python-dlp", + "sha": "57da1cb739d4914e37c3b69ffcdae4914def3176" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "915925089600094e72e4bfa8cf586c170e6b7109", + "internalRef": "366152684" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4" + "sha": "6d76df2138f8f841e5a5b9ac427f81def520c15f" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4" + "sha": "6d76df2138f8f841e5a5b9ac427f81def520c15f" } } ], @@ -40,98 +40,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/conf.py", - "docs/dlp_v2/services.rst", - "docs/dlp_v2/types.rst", - "docs/multiprocessing.rst", - "google/cloud/dlp/__init__.py", - "google/cloud/dlp/py.typed", - "google/cloud/dlp_v2/__init__.py", - "google/cloud/dlp_v2/proto/dlp.proto", - "google/cloud/dlp_v2/proto/storage.proto", - "google/cloud/dlp_v2/py.typed", - "google/cloud/dlp_v2/services/__init__.py", - "google/cloud/dlp_v2/services/dlp_service/__init__.py", - "google/cloud/dlp_v2/services/dlp_service/async_client.py", - "google/cloud/dlp_v2/services/dlp_service/client.py", - "google/cloud/dlp_v2/services/dlp_service/pagers.py", - "google/cloud/dlp_v2/services/dlp_service/transports/__init__.py", - "google/cloud/dlp_v2/services/dlp_service/transports/base.py", - "google/cloud/dlp_v2/services/dlp_service/transports/grpc.py", - "google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py", - "google/cloud/dlp_v2/types/__init__.py", - "google/cloud/dlp_v2/types/dlp.py", - "google/cloud/dlp_v2/types/storage.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/noxfile.py", - "scripts/decrypt-secrets.sh", - "scripts/fixup_dlp_v2_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/dlp_v2/__init__.py", - "tests/unit/gapic/dlp_v2/test_dlp_service.py" ] } \ No newline at end of file diff --git a/synth.py b/synth.py index 91b953d9..9f2771a8 100644 --- a/synth.py +++ b/synth.py @@ -42,7 +42,8 @@ # Add templated files # ---------------------------------------------------------------------------- templated_files = common.py_library( - system_test_dependencies=["test_utils"], samples=True, microgenerator=True + system_test_dependencies=["test_utils"], samples=True, microgenerator=True, + cov_level=98 ) s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 6cc72111..2a5b1cbf 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,6 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.22.0 +google-api-core==1.22.2 proto-plus==0.4.0 -libcst==0.2.5 \ No newline at end of file +libcst==0.2.5 diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/gapic/dlp_v2/__init__.py b/tests/unit/gapic/dlp_v2/__init__.py index 8b137891..42ffdf2b 100644 --- a/tests/unit/gapic/dlp_v2/__init__.py +++ b/tests/unit/gapic/dlp_v2/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# 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. +# diff --git a/tests/unit/gapic/dlp_v2/test_dlp_service.py b/tests/unit/gapic/dlp_v2/test_dlp_service.py index 0f79c156..35a74f2f 100644 --- a/tests/unit/gapic/dlp_v2/test_dlp_service.py +++ b/tests/unit/gapic/dlp_v2/test_dlp_service.py @@ -90,7 +90,22 @@ def test__get_default_mtls_endpoint(): assert DlpServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [DlpServiceClient, DlpServiceAsyncClient]) +@pytest.mark.parametrize("client_class", [DlpServiceClient, DlpServiceAsyncClient,]) +def test_dlp_service_client_from_service_account_info(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == "dlp.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [DlpServiceClient, DlpServiceAsyncClient,]) def test_dlp_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -99,16 +114,21 @@ def test_dlp_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "dlp.googleapis.com:443" def test_dlp_service_client_get_transport_class(): transport = DlpServiceClient.get_transport_class() - assert transport == transports.DlpServiceGrpcTransport + available_transports = [ + transports.DlpServiceGrpcTransport, + ] + assert transport in available_transports transport = DlpServiceClient.get_transport_class("grpc") assert transport == transports.DlpServiceGrpcTransport @@ -157,7 +177,7 @@ def test_dlp_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -173,7 +193,7 @@ def test_dlp_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -189,7 +209,7 @@ def test_dlp_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -217,7 +237,7 @@ def test_dlp_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -266,29 +286,25 @@ def test_dlp_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -297,66 +313,53 @@ def test_dlp_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -382,7 +385,7 @@ def test_dlp_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -412,7 +415,7 @@ def test_dlp_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -429,7 +432,7 @@ def test_dlp_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -468,6 +471,22 @@ def test_inspect_content_from_dict(): test_inspect_content(request_type=dict) +def test_inspect_content_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.inspect_content), "__call__") as call: + client.inspect_content() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.InspectContentRequest() + + @pytest.mark.asyncio async def test_inspect_content_async( transport: str = "grpc_asyncio", request_type=dlp.InspectContentRequest @@ -593,6 +612,22 @@ def test_redact_image_from_dict(): test_redact_image(request_type=dict) +def test_redact_image_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.redact_image), "__call__") as call: + client.redact_image() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.RedactImageRequest() + + @pytest.mark.asyncio async def test_redact_image_async( transport: str = "grpc_asyncio", request_type=dlp.RedactImageRequest @@ -722,6 +757,24 @@ def test_deidentify_content_from_dict(): test_deidentify_content(request_type=dict) +def test_deidentify_content_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.deidentify_content), "__call__" + ) as call: + client.deidentify_content() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeidentifyContentRequest() + + @pytest.mark.asyncio async def test_deidentify_content_async( transport: str = "grpc_asyncio", request_type=dlp.DeidentifyContentRequest @@ -850,6 +903,24 @@ def test_reidentify_content_from_dict(): test_reidentify_content(request_type=dict) +def test_reidentify_content_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.reidentify_content), "__call__" + ) as call: + client.reidentify_content() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ReidentifyContentRequest() + + @pytest.mark.asyncio async def test_reidentify_content_async( transport: str = "grpc_asyncio", request_type=dlp.ReidentifyContentRequest @@ -976,6 +1047,22 @@ def test_list_info_types_from_dict(): test_list_info_types(request_type=dict) +def test_list_info_types_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_info_types), "__call__") as call: + client.list_info_types() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListInfoTypesRequest() + + @pytest.mark.asyncio async def test_list_info_types_async( transport: str = "grpc_asyncio", request_type=dlp.ListInfoTypesRequest @@ -1124,6 +1211,24 @@ def test_create_inspect_template_from_dict(): test_create_inspect_template(request_type=dict) +def test_create_inspect_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_inspect_template), "__call__" + ) as call: + client.create_inspect_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CreateInspectTemplateRequest() + + @pytest.mark.asyncio async def test_create_inspect_template_async( transport: str = "grpc_asyncio", request_type=dlp.CreateInspectTemplateRequest @@ -1353,6 +1458,24 @@ def test_update_inspect_template_from_dict(): test_update_inspect_template(request_type=dict) +def test_update_inspect_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_inspect_template), "__call__" + ) as call: + client.update_inspect_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.UpdateInspectTemplateRequest() + + @pytest.mark.asyncio async def test_update_inspect_template_async( transport: str = "grpc_asyncio", request_type=dlp.UpdateInspectTemplateRequest @@ -1590,6 +1713,24 @@ def test_get_inspect_template_from_dict(): test_get_inspect_template(request_type=dict) +def test_get_inspect_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_inspect_template), "__call__" + ) as call: + client.get_inspect_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.GetInspectTemplateRequest() + + @pytest.mark.asyncio async def test_get_inspect_template_async( transport: str = "grpc_asyncio", request_type=dlp.GetInspectTemplateRequest @@ -1799,6 +1940,24 @@ def test_list_inspect_templates_from_dict(): test_list_inspect_templates(request_type=dict) +def test_list_inspect_templates_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_inspect_templates), "__call__" + ) as call: + client.list_inspect_templates() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListInspectTemplatesRequest() + + @pytest.mark.asyncio async def test_list_inspect_templates_async( transport: str = "grpc_asyncio", request_type=dlp.ListInspectTemplatesRequest @@ -2153,6 +2312,24 @@ def test_delete_inspect_template_from_dict(): test_delete_inspect_template(request_type=dict) +def test_delete_inspect_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_inspect_template), "__call__" + ) as call: + client.delete_inspect_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeleteInspectTemplateRequest() + + @pytest.mark.asyncio async def test_delete_inspect_template_async( transport: str = "grpc_asyncio", request_type=dlp.DeleteInspectTemplateRequest @@ -2356,6 +2533,24 @@ def test_create_deidentify_template_from_dict(): test_create_deidentify_template(request_type=dict) +def test_create_deidentify_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_deidentify_template), "__call__" + ) as call: + client.create_deidentify_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CreateDeidentifyTemplateRequest() + + @pytest.mark.asyncio async def test_create_deidentify_template_async( transport: str = "grpc_asyncio", request_type=dlp.CreateDeidentifyTemplateRequest @@ -2589,6 +2784,24 @@ def test_update_deidentify_template_from_dict(): test_update_deidentify_template(request_type=dict) +def test_update_deidentify_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_deidentify_template), "__call__" + ) as call: + client.update_deidentify_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.UpdateDeidentifyTemplateRequest() + + @pytest.mark.asyncio async def test_update_deidentify_template_async( transport: str = "grpc_asyncio", request_type=dlp.UpdateDeidentifyTemplateRequest @@ -2830,6 +3043,24 @@ def test_get_deidentify_template_from_dict(): test_get_deidentify_template(request_type=dict) +def test_get_deidentify_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_deidentify_template), "__call__" + ) as call: + client.get_deidentify_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.GetDeidentifyTemplateRequest() + + @pytest.mark.asyncio async def test_get_deidentify_template_async( transport: str = "grpc_asyncio", request_type=dlp.GetDeidentifyTemplateRequest @@ -3043,6 +3274,24 @@ def test_list_deidentify_templates_from_dict(): test_list_deidentify_templates(request_type=dict) +def test_list_deidentify_templates_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_deidentify_templates), "__call__" + ) as call: + client.list_deidentify_templates() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListDeidentifyTemplatesRequest() + + @pytest.mark.asyncio async def test_list_deidentify_templates_async( transport: str = "grpc_asyncio", request_type=dlp.ListDeidentifyTemplatesRequest @@ -3411,6 +3660,24 @@ def test_delete_deidentify_template_from_dict(): test_delete_deidentify_template(request_type=dict) +def test_delete_deidentify_template_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_deidentify_template), "__call__" + ) as call: + client.delete_deidentify_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeleteDeidentifyTemplateRequest() + + @pytest.mark.asyncio async def test_delete_deidentify_template_async( transport: str = "grpc_asyncio", request_type=dlp.DeleteDeidentifyTemplateRequest @@ -3624,6 +3891,24 @@ def test_create_job_trigger_from_dict(): test_create_job_trigger(request_type=dict) +def test_create_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_job_trigger), "__call__" + ) as call: + client.create_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CreateJobTriggerRequest() + + @pytest.mark.asyncio async def test_create_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.CreateJobTriggerRequest @@ -3864,6 +4149,24 @@ def test_update_job_trigger_from_dict(): test_update_job_trigger(request_type=dict) +def test_update_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_job_trigger), "__call__" + ) as call: + client.update_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.UpdateJobTriggerRequest() + + @pytest.mark.asyncio async def test_update_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.UpdateJobTriggerRequest @@ -4094,6 +4397,24 @@ def test_hybrid_inspect_job_trigger_from_dict(): test_hybrid_inspect_job_trigger(request_type=dict) +def test_hybrid_inspect_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.hybrid_inspect_job_trigger), "__call__" + ) as call: + client.hybrid_inspect_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.HybridInspectJobTriggerRequest() + + @pytest.mark.asyncio async def test_hybrid_inspect_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.HybridInspectJobTriggerRequest @@ -4311,6 +4632,22 @@ def test_get_job_trigger_from_dict(): test_get_job_trigger(request_type=dict) +def test_get_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_job_trigger), "__call__") as call: + client.get_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.GetJobTriggerRequest() + + @pytest.mark.asyncio async def test_get_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.GetJobTriggerRequest @@ -4513,6 +4850,24 @@ def test_list_job_triggers_from_dict(): test_list_job_triggers(request_type=dict) +def test_list_job_triggers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_triggers), "__call__" + ) as call: + client.list_job_triggers() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListJobTriggersRequest() + + @pytest.mark.asyncio async def test_list_job_triggers_async( transport: str = "grpc_asyncio", request_type=dlp.ListJobTriggersRequest @@ -4843,6 +5198,24 @@ def test_delete_job_trigger_from_dict(): test_delete_job_trigger(request_type=dict) +def test_delete_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_job_trigger), "__call__" + ) as call: + client.delete_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeleteJobTriggerRequest() + + @pytest.mark.asyncio async def test_delete_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.DeleteJobTriggerRequest @@ -5056,6 +5429,24 @@ def test_activate_job_trigger_from_dict(): test_activate_job_trigger(request_type=dict) +def test_activate_job_trigger_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_job_trigger), "__call__" + ) as call: + client.activate_job_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ActivateJobTriggerRequest() + + @pytest.mark.asyncio async def test_activate_job_trigger_async( transport: str = "grpc_asyncio", request_type=dlp.ActivateJobTriggerRequest @@ -5211,6 +5602,22 @@ def test_create_dlp_job_from_dict(): test_create_dlp_job(request_type=dict) +def test_create_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_dlp_job), "__call__") as call: + client.create_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CreateDlpJobRequest() + + @pytest.mark.asyncio async def test_create_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.CreateDlpJobRequest @@ -5487,6 +5894,22 @@ def test_list_dlp_jobs_from_dict(): test_list_dlp_jobs(request_type=dict) +def test_list_dlp_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_dlp_jobs), "__call__") as call: + client.list_dlp_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListDlpJobsRequest() + + @pytest.mark.asyncio async def test_list_dlp_jobs_async( transport: str = "grpc_asyncio", request_type=dlp.ListDlpJobsRequest @@ -5796,6 +6219,22 @@ def test_get_dlp_job_from_dict(): test_get_dlp_job(request_type=dict) +def test_get_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_dlp_job), "__call__") as call: + client.get_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.GetDlpJobRequest() + + @pytest.mark.asyncio async def test_get_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.GetDlpJobRequest @@ -5989,6 +6428,22 @@ def test_delete_dlp_job_from_dict(): test_delete_dlp_job(request_type=dict) +def test_delete_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_dlp_job), "__call__") as call: + client.delete_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeleteDlpJobRequest() + + @pytest.mark.asyncio async def test_delete_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.DeleteDlpJobRequest @@ -6167,6 +6622,22 @@ def test_cancel_dlp_job_from_dict(): test_cancel_dlp_job(request_type=dict) +def test_cancel_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_dlp_job), "__call__") as call: + client.cancel_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CancelDlpJobRequest() + + @pytest.mark.asyncio async def test_cancel_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.CancelDlpJobRequest @@ -6287,6 +6758,24 @@ def test_create_stored_info_type_from_dict(): test_create_stored_info_type(request_type=dict) +def test_create_stored_info_type_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stored_info_type), "__call__" + ) as call: + client.create_stored_info_type() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.CreateStoredInfoTypeRequest() + + @pytest.mark.asyncio async def test_create_stored_info_type_async( transport: str = "grpc_asyncio", request_type=dlp.CreateStoredInfoTypeRequest @@ -6504,6 +6993,24 @@ def test_update_stored_info_type_from_dict(): test_update_stored_info_type(request_type=dict) +def test_update_stored_info_type_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stored_info_type), "__call__" + ) as call: + client.update_stored_info_type() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.UpdateStoredInfoTypeRequest() + + @pytest.mark.asyncio async def test_update_stored_info_type_async( transport: str = "grpc_asyncio", request_type=dlp.UpdateStoredInfoTypeRequest @@ -6729,6 +7236,24 @@ def test_get_stored_info_type_from_dict(): test_get_stored_info_type(request_type=dict) +def test_get_stored_info_type_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stored_info_type), "__call__" + ) as call: + client.get_stored_info_type() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.GetStoredInfoTypeRequest() + + @pytest.mark.asyncio async def test_get_stored_info_type_async( transport: str = "grpc_asyncio", request_type=dlp.GetStoredInfoTypeRequest @@ -6930,6 +7455,24 @@ def test_list_stored_info_types_from_dict(): test_list_stored_info_types(request_type=dict) +def test_list_stored_info_types_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stored_info_types), "__call__" + ) as call: + client.list_stored_info_types() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.ListStoredInfoTypesRequest() + + @pytest.mark.asyncio async def test_list_stored_info_types_async( transport: str = "grpc_asyncio", request_type=dlp.ListStoredInfoTypesRequest @@ -7284,6 +7827,24 @@ def test_delete_stored_info_type_from_dict(): test_delete_stored_info_type(request_type=dict) +def test_delete_stored_info_type_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stored_info_type), "__call__" + ) as call: + client.delete_stored_info_type() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.DeleteStoredInfoTypeRequest() + + @pytest.mark.asyncio async def test_delete_stored_info_type_async( transport: str = "grpc_asyncio", request_type=dlp.DeleteStoredInfoTypeRequest @@ -7477,6 +8038,24 @@ def test_hybrid_inspect_dlp_job_from_dict(): test_hybrid_inspect_dlp_job(request_type=dict) +def test_hybrid_inspect_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.hybrid_inspect_dlp_job), "__call__" + ) as call: + client.hybrid_inspect_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.HybridInspectDlpJobRequest() + + @pytest.mark.asyncio async def test_hybrid_inspect_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.HybridInspectDlpJobRequest @@ -7671,6 +8250,22 @@ def test_finish_dlp_job_from_dict(): test_finish_dlp_job(request_type=dict) +def test_finish_dlp_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DlpServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.finish_dlp_job), "__call__") as call: + client.finish_dlp_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == dlp.FinishDlpJobRequest() + + @pytest.mark.asyncio async def test_finish_dlp_job_async( transport: str = "grpc_asyncio", request_type=dlp.FinishDlpJobRequest @@ -7810,7 +8405,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport], + [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -7943,6 +8538,48 @@ def test_dlp_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport], +) +def test_dlp_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_dlp_service_host_no_port(): client = DlpServiceClient( credentials=credentials.AnonymousCredentials(), @@ -7962,7 +8599,7 @@ def test_dlp_service_host_with_port(): def test_dlp_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.DlpServiceGrpcTransport( @@ -7974,7 +8611,7 @@ def test_dlp_service_grpc_transport_channel(): def test_dlp_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.DlpServiceGrpcAsyncIOTransport( @@ -7985,6 +8622,8 @@ def test_dlp_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport], @@ -7994,7 +8633,7 @@ def test_dlp_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -8032,6 +8671,8 @@ def test_dlp_service_transport_channel_mtls_with_client_cert_source(transport_cl assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport], @@ -8044,7 +8685,7 @@ def test_dlp_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel